Tuesday, 20 August 2013

Remove Characters from a String that doesn't comply with the Regex Rule using JQuery

Remove Characters from a String that doesn't comply with the Regex Rule
using JQuery

I want to know how can I remove characters that doesn't fall into the ones
allowed in my Regex expressions.
I use this regular expression which allows all charactes from any
language, space and apostrophe, but all other characters are not allowed.
/[\u00C0-\u1FFF\u2C00-\uD7FF\w \']/
I want to create a jquery function that remove all the characters in an
text input field that doesn't comply to that rule. So for example: the
dagger character '‡' is not allowed and therefore should be replaced with
an empty string '' (aka removed from the string).

No comments:

Post a Comment