diff options
author | Manolo Carrasco <manolo@apache.org> | 2012-03-19 18:37:13 +0000 |
---|---|---|
committer | Manolo Carrasco <manolo@apache.org> | 2012-03-19 18:37:13 +0000 |
commit | d037f0cdb0794952ad3aacf51df1d77d8f63a364 (patch) | |
tree | 9eb39b0e28975a062c92aa34a13b888c3369ca79 | |
parent | d7b850b227f372f07ec99ffab859b567a45e91be (diff) | |
download | gwtquery-d037f0cdb0794952ad3aacf51df1d77d8f63a364.tar.gz gwtquery-d037f0cdb0794952ad3aacf51df1d77d8f63a364.zip |
Fix regular expression which only work in jvm (dev mode)
-rw-r--r-- | gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/ajax/Ajax.java | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/ajax/Ajax.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/ajax/Ajax.java index fe6c41f4..5b727aba 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/ajax/Ajax.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/ajax/Ajax.java @@ -344,11 +344,14 @@ public class Ajax extends GQuery { public void f() { try { // We clean up the returned string to smoothly append it to our document + // Note: using '\s\S' instead of '.' because gwt String emulation does + // not support java embedded flag expressions (?s) and javascript does + // not have multidot flag. String s = getData()[0].toString().replaceAll("<![^>]+>\\s*", "") - .replaceAll("(?si)</?html[^>]*>\\s*", "") - .replaceFirst("(?si)<head[^>]*>.*</head>\\s*", "") - .replaceFirst("(?si)<script[^>]*>.*</script>\\s*", "") - .replaceAll("<?si></?body[^>]*>\\s*", ""); + .replaceAll("</?html[\\s\\S]*?>\\s*", "") + .replaceAll("<head[\\s\\S]*?</head>\\s*", "") + .replaceAll("<script[\\s\\S]*?</script>\\s*", "") + .replaceAll("</?body[\\s\\S]*?>\\s*", ""); // We wrap the results in a div s = "<div>" + s + "</div>"; |