i need a regex code that matches Numbers/Persian Characters And Latin ( A-Z )
i wrote the following code
preg_match("/[A-Za-z\s\x{0600}-\x{06FF}0-9_\.\- ]/u",$_POST['input'] )
and works fine .
but there is a problem, i dont want to input have any ( @,#,!,%,$,&,* ) characters .
any ideas?
Just use an negative lookahead assertion in your regex to check that there is no such character. Place this at the beginning of your regex. I mean just after the /.
(?!.*[(@#!%$&*)])
For example:
preg_match("/^(?!.*[(@#!%$&*)])[A-Za-z\s\x{0600}-\x{06FF}0-9_\.\- ]+$/u",$_POST['input'] )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With