开发者

Regex not working as expected [duplicate]

This question already has answers here: What regex to use for this (6 answers) Closed 4 years ago.

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜