Internationalized Javascript Regex Validation

We had a requirement to support a strange javascript validation which should include validation for words, numbers, space, ‘>’, ‘<' and '$'. It was quite easy to get this one going. However, we faced an issue with internationalization as there are some problems with the current regex validations provided by ECMA. (JavaScript's definition of "word character" does not include international characters). The solution regex for it is mentioned below in a javascript function:

function validateName()
    var nameRegEx = /[^a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF0-9\s&gt;&lt;$]/;     
    return (!nameRegEx .test($('userName').value));

Visit StackOverFlow for more information


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s