Hey guys,
Im considerably familiar with the use of regular expressions in Java (and other languages), yet seem to be having a very simple problem.
I wish to match a full stop character occuring after a space in a string, once that space does not occur after a digit.
e.g. "went to the shop . This is another sentence"
The code I'm using is this:
String s = "went to the shop. This is another sentence"
s = s.replaceAll("([^0-9]+)\\s+\\.","$1.");
This doesn't seem to work, neither does:
String s = "went to the shop. This is another sentence"
s = s.replaceAll("(\\D+)\\s+\\.","$1.");
It seems that there's a problem with the first + symbol, but I'm not sure exactly what the problem is.
Any insights?
Edited by: SuperGrover on Jan 19, 2009 12:35 PM