Regex problem with recognizing alphanumericals
I am trying to build a regex which filters alphanumerical strings. That means something like "12ab" or "ab12" or "a12b". I must not match with single chars or numbers. My attempt was '[0-9a-zA-Z]+'.开发者_StackOverflow社区 But this didn t work. For me it is a problem to say "the string starts with a character or a number ..."
Here some examples.
to be recognized: "aab2" "23ab" "a1" "a2acd"
not to be recognized: "a" "aads" "1" "232323" "." "+" "sas+"
Greetings, Haniball
^([a-zA-Z]+[0-9]+)|([0-9]+[a-zA-Z]+)[a-zA-Z0-9]*$
精彩评论