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

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

datatable - Matlab struct computations -