6 Replies Latest reply: Jul 18, 2007 9:05 AM by 800383 RSS

    Java validation with regular expression

    807605
      Hi

      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.