[regex] Regular Expression for alphanumeric and underscores

In Computer Science, an Alphanumeric value often means the first character is not a number but is an alphabet or underscore. Thereafter the character can be 0-9, A-Z, a-z, or underscore (_).

Here is how you would do that:

Tested under php:

$regex = '/^[A-Za-z_][A-Za-z\d_]*$/'

or take this

^[A-Za-z_][A-Za-z\d_]*$

and place it in your development language.