I want to match all punctuations, but not "'", as in "I'm". For example, in the sentence below:
I'm a student, but I'm also working.
^not match ^match ^not ^match
I can use "[[:punct:]]+" to match all punctuations, but I'm having hard time to exclude "'" from the matching pattern.
Of course, I could use someting like the following to express by enumeration, but it's much tedious, especially considering all those punctuations for Chinese as well.
"[,.?!]"
Please suggest a more elegant solution.
Thanks in advance,
Yu
If your regex flavor supports look-arounds, you could do this:
(?!')[[:punct:]]
In plain English: if there's no single quote when looking ahead, match any punctuation mark.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With