hi
if (ereg("[A-Za-z0-9#$*+=:%]+$",$teststring)) {
echo "$teststring is valid.";
} else {
echo "$teststring is invalid.";
}
should work.
It doesn't accept:
- accented letters like 'äöü'
- empty strings
- dots ('.')
The expression asks, if $teststring contains only one ore more [+] of the characters between '[' and ']' from the beginning () to the end ($). If you want to accept empty strings, replace the '+' at the end of the expression with a '*'.
HIH
-Christoph