83
rated 0 times
[
90]
[
7]
/ answers: 1 / hits: 76564
/ 9 Years ago, mon, august 10, 2015, 12:00:00
I was looking for a regex to match words with hyphens and/or apostrophes. So far, I have:
(w+([-'])(w+)?[']?(w+))
and that works most of the time, though if there's a apostrophe and then a hyphen, like qu'est-ce, it doesn't match. I could append more optionals, though perhaps there's another more efficient way?
Some examples of what I'm trying to match: Mary's, High-school, 'tis, Chambers', Qu'est-ce.
More From » regex