3 に答える
How about
/[\u2019]/
It uses the actual character rather than the html entity. 2019 is hex for 821710
As long as you properly tag encoding of your JavaScript (or its holding page if it is inline) either through charset
attribute or Content-Type
header, you can just use any character that doesn't have special meaning in regexp just by typing it there literally:
/’/
Alternative of ’
or ’
in regex in most of environments is
\u2019
however in Perl and PCRE \u
is not supported , but \x
syntax instead
\x2019
as 2019
is hex of decimal 8217
.
Regarding unicode with regex in Javascript read: Javascript + Unicode regexes