I'm very new to using regular expressions and am trying to allow only A-Z, a-z, 0-9, -, _
I'm using the following expression which is working:
preg_match('/^[a-zA-Z0-9-_]+$/i', $_POST['sign_up_username'])
My question is if this is the correct way to go about doing this. I'm not sure if this is the right place to post this. Any help would be great. Thanks.