I trying to use regex within the replaceAll function. I need to do a real simple task which is to switch ever = and ~ operator with a : char with no spaces!
For instance:
(srcIP = 0.0.0.0) AND (dstIP~0.0.0.0 OR protocol = TCP)
turns to
(srcIP:0.0.0.0) AND (dstIP:0.0.0.0 OR protocol:TCP)
I am trying to use the following code
query.replaceAll("[ ]*(=|~)[ ]*", ":");
but it doesn't work. Is there any way to do this using replaceAll function? It seems that it doesn't work with regex.
replaceAllandreplacedon't change theString, they create a new one.