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! ;)
加载中,请稍侯......
精彩评论