On my registration page I need to validate the usernames as alphanumeric only, but also with optional underscores. I\'ve come up with this:
function validate
try
function validate_alphanumeric_underscore($str) { return preg_match('/^[a-zA-Z0-9_]+$/',$str); }