Can A Regex Whitespace Character Cause An Injection?
if I want to validate the input of a
Solution 1:
/[0-9\s]/
should be a safe whitelist to use, I believe. You do need to ensure that it checks the entire input, though; I think you mean /^[0-9\s]*$/
.
Also remember, of course, that you have to validate it server-side, not just in the browser. Attackers can easily bypass JavaScript validation code.
Post a Comment for "Can A Regex Whitespace Character Cause An Injection?"