I don’t want preg_match_all … because the form field only allows for numbers and letters… just wondering what the right syntax is…
Nothing fancy … just need to know the right syntax for a preg_match statement that looks for only numbers and letters. Something like
preg_match('/^([^.]+)\.([^.]+)\.com$/', $unit)
But that doesn’t look for numbers too….
If you just want to ensure a string contains only alphanumeric characters. A-Z, a-z, 0-9 you don’t need to use regular expressions.
Use
ctype_alnum()Example from the documentation:
The above example will output: