Here is a code sample that you can try in QIE:
var s = new java.lang.String("Hello HELLO heLLo HellO hellO hello \\r\\n\\.");
qie.debug(s.replaceAll("Hello", "NONE@EMAIL.COM"));
// qie.debug(s.replaceAll("?i" + "Hello", "NONE@EMAIL.COM"));
qie.debug(s.replaceAll("(?i)" + "Hello", "NONE@EMAIL.COM"));
qie.debug(s.replaceAll("(?i)" + java.util.regex.Pattern.quote("Hello"), "NONE@EMAIL.COM"));
qie.debug(s.replaceAll("(?i)" + "\\r\\n\\.", "Stuff"));
qie.debug(s.replaceAll("(?i)" + java.util.regex.Pattern.quote("\\r\\n\\."), "Stuff"));
Some things to note in the above snippet:
1. This only work on the Java String class of strings not JavaScript strings. So, be sure to convert any JavaScript strings to Java String.
2. Wrap the ?i in parenthesis, like so: (?i). If you uncomment the line without out it wrapped it, throws the following error:
WrappedException: Wrapped java.util.regex.PatternSyntaxException: Dangling meta character '?' near index 0
?iHello
^
3. Use Pattern.quote (if needed) to avoid the replacement string from being interpreted as a regex pattern (which may cause unexpected results). Converts it to a string literal.
See:
Which states:
"This method produces a String that can be used to create a Pattern that would match the string s as if it were a literal pattern"