Regular Expressions 101

Community Patterns

Find Apostrophe via Regex and JavaScript

1

Regular Expression
ECMAScript (JavaScript)

/
\b(^|[a-z0-9\-\—]+)(\s?)(\'|||\’)(\s?)((s|d|ll|nt|(t(is?|s?){1,2}){1,3}|((r|v){1}(e?){1}){1,2})\b)
/
gi

Description

This is function matching apostrophe via regex and JavaScript. Also find broken apostrophe and match whole word.

Submitted by Ivijan-Stefan Stipic <creativform@gmail.com> - 7 years ago