I have following code to perform some regular expression on the string
public class RegexForPresto {
public static void main(String[] args) {
Pattern p = Pattern.compile("^M^M rawtostampedMsg^L 48^UT ");
String candidateString = "^M^M rawtostampedMsg^L 48^UT 1338802566.906^EOH^name;
Matcher matcher = p.matcher(candidateString);
String tmp = matcher.replaceAll("");
System.out.println(tmp);
}
}
Instead of just getting
^EOH^name
I get following output when I execute
^M^M rawtostampedMsg^L 48^UT 1338802566.906^EOH^name
Also is it possible to remove “^EOH^” from the string so as to get only “name” as the output. I don’t know how to remove the special character( “^”). Any help is appreciated.
Thanks in advance.
Though I have not tested the code, I think this should work for you: