开发者

Small remake of this regexp to allow these special character in beginning

I have this regexp:

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

This is for validating a textarea.

Currently, you cant use the three Swedish language letters in the beginning.

The letters are å, ä, ö, Å, Ä, Ö.

Also, I would like it to allow the minus sign and the star (multiplication) sign:

- and *

Is there any remake to allow them in the beginning?

They are currently allowed in the middle of texts, and endings...

Here is how I compare:

if (!fld.value.match(desExp)){ 
    //ERROR

Thanks

UPDATE:

The above allows small characters of swedish å ä ö, but not uppercase, and not multi开发者_Go百科plication-sign and minus-sign, which I still need to work.

Thanks


This RegExp should work, but you have to set the flag i to allow them upperCase too.


Try

/^\s*([\wåäö*-][^\w]*){3}.*$/gmi;

This should allow uppercase characters as well as * and -.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜