]> source.dussan.org Git - gwtquery.git/commitdiff
Fix regular expression which only work in jvm (dev mode)
authorManolo Carrasco <manolo@apache.org>
Mon, 19 Mar 2012 18:37:13 +0000 (18:37 +0000)
committerManolo Carrasco <manolo@apache.org>
Mon, 19 Mar 2012 18:37:13 +0000 (18:37 +0000)
gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/ajax/Ajax.java

index fe6c41f4fc3d3765910998dae6dcbaf7045be38f..5b727aba0b6b614ac23a84bd08378ec596b2048a 100644 (file)
@@ -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>";