开发者

jquery validate swedish character

I'm using jquery validate plugin and extending it like that

jQuery.validator.addMethod("noNumeric", function(value, element) {
            return this.optional(element) || /^[a-zA-Z]+$/i.test(value);
        }, "Letters only please");

Its working fine but not valid for swedish charecter.

Which regular expression can be used to test for characters (including swedish accented ones) but which also EXCLUDES (i.e. does not match) special characters like commas, dollars, hashes开发者_StackOverflow中文版 etc?


You should be ok to use \w meaning any character found in a word - should work in most languages:

/^\w+$/


According to regular-expressions.info javascript has no unicode support for regular expressions. So \w will not work.

But you can add the special characters to your character class like

/^[a-zA-ZäÄöÖüÜß]+$/

I used the german ones I don't no the swedish.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜