java - Seemingly Pointless Regex Found in Code -
so inherited code , looking through code found regex seems allow pretty string. regex is:
^(?=\\s*\\s).*$
this on field saved database thought maybe doing basic sql injection protection. thoughts? can tell checking there start\end of line, have positive lookahead white space or non-white space character, , allowing characters.
^(?=\\s*\\s).*$
this says there cannot empty string
.there has 1 non space character.so string ' '
not pass neither ""
.
this similar ^.*\s.*$
.lookaheads
expensive can use this.
Comments
Post a Comment