Java regex to find whitespaces or upper-case characters -
I have a method that validates the string and ensures that it has any white space or upper- The cases are not:
boolean valid (string input) {if (input.matches (". * * \\ S * ([AZ] +)")) {return false; } Back true; }
Unfortunately, when I run it, it just does not work. It does not throw any exceptions, it only allows to pass verification to all input strings ("HelloWald", "Hello World", "Hello World", etc.). Any ideas where I am going wrong?
you explanation Ul Li> .matches ("[^
+
ensures that your string is at least 1 character or more.
Comments
Post a Comment