regular expression for validation not working

Posted by Camran on Stack Overflow See other posts from Stack Overflow or by Camran
Published on 2010-06-09T15:06:21Z Indexed on 2010/06/09 15:12 UTC
Read the original article Hit count: 161

Filed under:
|
|
|
|

I have a "description textarea" inside a form where user may enter a description for an item.

This is validated with javascript before the form beeing submitted.

One of the validation-steps is this:

  else if (!fld.value.match(desExp)){

And desExp:

 var desExp = /^\s*(\w[^\w]*){3}.*$/gm;

Now my problem, this works fine on all cases except for descriptions where the description BEGINS with a special character of the swedish language (å, ä, ö).

This wont work:

    åäö hello world

But this will:

    hello world åäö

Any fixes?

Thanks

© Stack Overflow or respective owner

Related posts about php

Related posts about JavaScript