Remove punctuation except Apostrophe Regex

preg_replace ("/(\p{P})/", ' ', $str)removes apostrophes, and it should not. Please, help

+3
source share
1 answer

Try the following:

/\p{P}(?<!')/

An additional external statement is that the punctuation character is not an apostrophe.

+6
source

Source: https://habr.com/ru/post/1712758/


All Articles