I want to allow characters like & and = but I seem to not be able to get it right. Is the below correct if I want to allow a string between 5-50 characters with special characters like (_.?&=)?
[A-Za-z0-9_.?&=]{5,50}
I want to allow characters like & and = but I seem to not be able to get it right. Is the below correct if I want to allow a string between 5-50 characters with special characters like (_.?&=)?
[A-Za-z0-9_.?&=]{5,50}
You probably want to anchor the start ("") and end ("$") of the string:
$preg_match('/^[A-Za-z0-9_.?&=]{5,50}$/', $string);
Found out what the problem was. Forgot that when I was filtering I used htmlentities and forgot to decode it.