I am using this regex:
.+?(?=[\s,])
To find matches in strings like this:
something1, something2, something3
The desired matches would be:
something1
,
something2
,
something3
Notice that the matches are keeping white space on the front of the matched strings. This works fine if the string I am searching has white space after 'something3' but if there is no white space then 'something3' never matches. I can not guarantee that there will be a white space character on the end of the string. How do I modify this regex to be able to match the last 'something3' weather there is white space or not?