I need to split a string (in Java) into individual words … but I need to preserve spaces.
An example of the text I need to split is something like this:
ABC . . . . DEF . . . . GHI
I need to see “ABC”, ” . . . .”, “DEF”, “. . . .”, and “GHI”.
Obviously splitting on the space character \s isn’t going to work, as all the spaces get swallowed up as one space.
Any suggestions?
Thanks
Thanks guys, that gave me the lead I needed … I’m using
(?<=[\\s])and it works exactly the way I want!