Validate HTML entities in JavaScript

Posted by Eduard Luca on Stack Overflow See other posts from Stack Overflow or by Eduard Luca
Published on 2012-10-19T22:55:11Z Indexed on 2012/10/19 23:01 UTC
Read the original article Hit count: 172

Filed under:
|

I have a small JavaScript validation script that validates inputs based on Regex. I want to allow certain characters that are not exactly common (not sure if they're UTF8). For example I want to allow the following character , which looks like a single quote, but isn't.

I got the HTML code for this which is ’, but I'm not sure how to put this into the Regex.

I've tried just inputting [&#8217]* but it doesn't validate.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about regex