php - Matching ONLY Numbers / Persian Characters And Latin -
i need regex code matches numbers/persian characters , latin ( a-z )
i wrote following code
preg_match("/[a-za-z\s\x{0600}-\x{06ff}0-9_\.\- ]/u",$_post['input'] )
and works fine .
but there problem, dont want input have ( @,#,!,%,$,&,* ) characters .
any ideas?
just use negative lookahead
assertion in regex check there no such character. place @ beginning of regex. mean after /
.
(?!.*[(@#!%$&*)])
for example:
preg_match("/^(?!.*[(@#!%$&*)])[a-za-z\s\x{0600}-\x{06ff}0-9_\.\- ]+$/u",$_post['input'] )
Comments
Post a Comment