I am getting this error "java.util.regex.PatternSyntaxException: Dangling meta character '?' near index 0"
I am reading an input file which has data like
In my code I am replacing the binary equivalent of ? that is "\u003F" with ""
text = text.replaceAll("\u003F","");
But I still get this error...
Any help is greatly appreciated
Thanks in advance.
Henry Wong wrote:The replaceAll() method takes a regex as the first parameter. And the "?" has special meaning in a regex. If you want it to behave as an literal question mark, then you will need to escape it.
text = text.replaceAll("\\?","");
I tried and that didn't work either.