Regex not working as expected [duplicate]
I'm having troube modifying this regex. Right now it matches .
or ?
bu开发者_StackOverflow社区t I want to change it to match dot followed by a space. How do I do that?
'('/([.|?])/'
By the way, I need the grouping to stay.
What about this:
(\. |\?)
......
The easiest way would be:
'('/(\. )/'
or, if you want a space or a tab or a new-line:
'('/(\.\s)/'
Note that I only changed the part in the inner parenthesis as that part seems to be the focus of your question.
/\.\s/
should work for matching a dot followed by a space..
note: \s
matches any whitespace
精彩评论