Remove punctuation marks except apostrophe Regex

regex, regex-negation

Solution

Try this:

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

The additional look-behind assertion is to ensure that the punctuation character is not an apostrophe.

Problem

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

Original source