Issue
This pattern is for check if this input form has ONLY special character, but i need to reverse it, so return true if the input form HAS NOT ONLY special character
<input type="text" pattern="[^a-zA-Z0-9]+">
EXAMPLE:
"Hello" is okay,
"Hello/;:" is okay,
";:.&" is NOT okay, cause it has ONLY special character
Solution
The pattern you're after is .*[a-zA-Z0-9].*
.
As a general rule, to check if a strings contains a match to a pattern, surround the pattern with .*
on both sides.
Answered By - Nicholas Weston
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.