Regular Expression for name

I think what you are trying to know is the generic regular expression which starts with any alphabets and has only alpha-numeric characters in it.
Look, the generic format (in java, for string pattern matching) for your query is this:

String pattern = "[a-zA-Z][a-zA-Z0-9]*";


String pattern = "[a-zA-Z](\\w)*";
  • represents kleene star operator which denotes the occurrences with one or more.
    \w consists of the word characters.

Then further you can use pattern-matcher functions to do your work.

Browse More Popular Posts

Leave a Comment