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 .matches ("[^

explanation Ul Li>

  • > + ensures that your string is at least 1 character or more.

  • Comments

    Popular posts from this blog

    sql - Find last match with latest inserted name in table -

    c# - XML serialize base class without knowing derived class -

    Send innerHTML text in URL in JSP -