superbiche
3/29/2015 - 4:13 PM

Validate string that must contain only alphanumeric values and eventually an underscore as separator. From http://stackoverflow.com/question

Validate string that must contain only alphanumeric values and eventually an underscore as separator. From http://stackoverflow.com/questions/1330693/validate-username-as-alphanumeric-with-underscores

$is_valid = preg_match('/^[A-Za-z][A-Za-z0-9]*(?:_[A-Za-z0-9]+)*$/', $str);