Index: sdk/lib/_internal/compiler/implementation/lib/string_helper.dart |
diff --git a/sdk/lib/_internal/compiler/implementation/lib/string_helper.dart b/sdk/lib/_internal/compiler/implementation/lib/string_helper.dart |
index 3a35778c677a431b508c26c8ed97d583c9c8b487..f70a975ac6666af26e3ff84154b97c9ec51140d8 100644 |
--- a/sdk/lib/_internal/compiler/implementation/lib/string_helper.dart |
+++ b/sdk/lib/_internal/compiler/implementation/lib/string_helper.dart |
@@ -75,6 +75,8 @@ stringReplaceJS(receiver, replacer, to) { |
return JS('String', r'#.replace(#, #)', receiver, replacer, to); |
} |
+final RegExp quoteRegExp = new JSSyntaxRegExp(r'[-[\]{}()*+?.,\\^$|#\s]'); |
+ |
stringReplaceAllUnchecked(receiver, from, to) { |
if (from is String) { |
if (from == "") { |
@@ -91,8 +93,6 @@ stringReplaceAllUnchecked(receiver, from, to) { |
return result.toString(); |
} |
} else { |
- RegExp quoteRegExp = |
- const JSSyntaxRegExp(r'[-[\]{}()*+?.,\\^$|#\s]'); |
var quoter = regExpMakeNative(quoteRegExp, global: true); |
var quoted = JS('String', r'#.replace(#, "\\$&")', from, quoter); |
RegExp replaceRegExp = new JSSyntaxRegExp(quoted); |