I’m trying to turn this text:
She’S Saying It’S Time To ‘Find A Solution’
into this text:
She’s Saying It’s Time To ‘Find A Solution’
only using Javascript.
I tried using:
str.replace(/'S /,"'s ");
but it doesn’t seem to work.
Any ideas? Please not that the whitespace after the S is an important heuristic.
I finally found the problem (none of the solutions below solved it…)
The problem was that my string was using a different type of single quote (’ instead of ‘). The replace function above only recognizes the second type of single quote…
SOLUTION: with a simple amendment, both single quotes can be replaced:
That’s it.