Answers for "regular expression for words and words with apostrophes"

0

regular expression for words and words with apostrophes

/(?:\w|['-]\w)+/
//matches: we, we're, were
//ignores: ' (lone apostrophe),  (whitespace)

OPPOSITE: /\s+|[^'-\w]+|[0-9]+/
//matches: numbers, whitespace, punctuation (except in contractions/hiphenated words)
//ignores: words/contractions/hiphenated words
Posted by: Guest on March-25-2021

Code answers related to "regular expression for words and words with apostrophes"

Browse Popular Code Answers by Language