Regex how to match all punctuations but exclude some conditions

后端 未结 2 1044
逝去的感伤
逝去的感伤 2021-01-14 00:13

I can use \\p{Punct} to match all punctuations(including underscore).

And I wanted to exclude all apostrophes strictly inside a word.

2条回答
  •  难免孤独
    2021-01-14 00:33

    You could group all punctuations, you are interested in, manually and exclude the apostrophe. Then combine that group with your rule for finding the right apostrophes (that are not within a word) by an OR.

提交回复
热议问题