In particular: I want to replace all occurances of a full stop \. with a full stop plus white space \.\s if the full stop is immediately followed by an upper case character [A-Z].
Any suggestions? thanks
In particular: I want to replace all occurances of a full stop \. with a full stop plus white space \.\s if the full stop is immediately followed by an upper case character [A-Z].
Any suggestions? thanks
You can try the regex s/\.([A-Z])/. \1/g
, like so:
myString.replaceAll("\\.([A-Z])", ". $1");
For more, see the Pattern
class and String.replaceAll
. Note that backslashes need to be escaped themselves, hence the double backslashes.