I am attempting to create a regex in JavaScript that matches the different forms of "their" and its possessive form.
Currently, I have their|their(?:'?s)
, which successfully matches their, theirs, and their's; but does not match theirs'.
Can anyone provide guidance on how to achieve this?
Therefore, their
, theirs
, their's
, and theirs'
should all be included in the regex pattern.
Considering that theirs
, their
, and theirs'
share similarities, the regex should prioritize longer matches. For example, if the word is theirs'
, it should only match that and not just their
or theirs
.
How would one address scenarios involving his
, his'
, his's
, his
, and avoid accidentally matching "hiss"?