regex - Matching non-whitespace in Java -
i detect strings have non-whitespace characters in them. right trying:
!pattern.matches("\\*\\s\\*", city)
but doesn't seem working. have suggestions? know trim string , test see if equals empty string, rather way
what think regex matches?
try
pattern p = pattern.compile( "\\s" ); matcher m = p.matcher( city ); if( m.find() ) //contains non whitespace
the find
method search partial matches, versus complete match. seems behavior need.
Comments
Post a Comment