I want to use JavaScript (can be with jQuery) to do some client-side validation to check whether a string matches the regex:(我想使用JavaScript(可以使用jQuery)进行一些客户端验证来检查字符串是否与正则表达式匹配:)
^([a-z0-9]{5,})$
Ideally it would be an expression that returned true or false.(理想情况下,它将是一个返回true或false的表达式。)
I'm a JavaScript newbie, does match()
do what I need?(我是一个JavaScript新手, match()
做我需要的吗?) It seems to check whether part of a string matches a regex, not the whole thing.(它似乎检查字符串的一部分是否匹配正则表达式,而不是整个事物。)
ask by Richard translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…