Reputation: 442
I want to store "~ s/\n|\s+|.*?=|;//g;"
in a string variable.
Can anyone help me in this. Thanks in advance.
Upvotes: 1
Views: 96
Reputation: 16952
You have to replace \
by \\
in a Java String literal.
See https://docs.oracle.com/javase/tutorial/essential/regex/literals.html (at the bottom).
That is
String regExp = "~ s/\\n|\s+|.*?=|;//g;";
should work.
Upvotes: 1