Hello,
Im trying to come up with a function to check if a string is valid or not.
Allowing only a-z A-Z 0-9 _ and -
so far, ive experimented with the normal [a-zA-Z0-9] but how could i add _ and - to that. And whats the best way? pregmatch? or eregi?
Im new to regex, so please excuse me for not knowing all the correct terms.
function is_valid_cred($var) {
if(validation would go here) {
return true;
} else {
return false;
}
}
Thanks for help on this matter.