3 Replies Latest reply: Jul 11, 2007 8:02 AM by 807605 RSS

    Validate string in regular expression


      I wanted to validate a name input in my project to check if it contains only characters or number and special characters like .(dot), -(hyphen) or _(underscore)

      I have formed this regular expression to check that:

      if(l_name.matches("[A-Za-z0-9._-]" ) )

      I am not sure whether it is right..anyway it does not work.

      Can somebody please correct me what is going wrong and suggest me how to make it work for my validation?