0

Possible Duplicate:
PHP - regex to allow letters and numbers only

I need a RegEx that matches a-z, A-Z and 0-9 strings. Not á, à, ð, ð, ü, ĉ, etc. How can I accomplish this?

Community
  • 1
  • 1
federico-t
  • 12,014
  • 19
  • 67
  • 111

2 Answers2

3

Try that one for example:

^[a-zA-Z0-9]*$
Petar Ivanov
  • 91,536
  • 11
  • 82
  • 95
0

Use a character class to match a single character:

[a-zA-Z0-9]

Apply quantifiers (*, +, whatever) as appropriate.

Karl Knechtel
  • 62,466
  • 11
  • 102
  • 153