开发者

Javascript Regular Expression

alert(/[a-zA-Z0-9 -_\.,]+/.test('test_string@');

I currently have the above code and I want to it to return false whenever something in the string doesn't match. For example, the string above has an @. The return would be true because test_string matches开发者_开发百科.

Is there a javascript function or some code that could help me with this?


There are beginning ^ and end $ of string matches:

/^[a-zA-Z0-9 \-_\.,]+$/.test('test_string@')
// ----------^ Also notice that escape! ;)
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜