6 Replies Latest reply on Jul 18, 2007 2:05 PM by phantasmo

    Java validation with regular expression


      I need to validate a string such that only numbers, alphabets, -, _, . is allowed and the below mentioned code works fine.

      if( ! l_name.matches("[A-Za-z0-9._-]+" ) ) {
      // do stuff when a valid name is found

      But i need to modify the above regex such that it should also allow space in the name. Any idea how to do that?

      Thanks in advance.