Last active
April 8, 2019 14:29
-
-
Save hosseinm1997/7cecb6950e63d70bd9e33efeb2f9a86b to your computer and use it in GitHub Desktop.
اعتبار سنجی دقیق نام های ایرانی با کارکتر های فارسی بوسیله عبارات منظم _ Iranian names with only Farsi/Persian character validation with regular expression.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$fname = 'حسین'; | |
if (!preg_match('/^([\x{0621}-\x{063A}\x{0641}-\x{064A}\x{064E}-\x{0651}\x{0654}-\x{0655}\x{06A9}\x{06CC}\x{FB8A}\x{067E}\x{0686}\x{06AF}\x{0698}\x{0670}\x{200c}\x{06c1}\x{06c2} ])+$/u', $fname)) | |
{ | |
echo "نام معتبر نیست!"; | |
} | |
$fname = 'hossein'; | |
if (!preg_match('/^([\x{0621}-\x{063A}\x{0641}-\x{064A}\x{064E}-\x{0651}\x{0654}-\x{0655}\x{06A9}\x{06CC}\x{FB8A}\x{067E}\x{0686}\x{06AF}\x{0698}\x{0670}\x{200c}\x{06c1}\x{06c2} ])+$/u', $fname)) | |
{ | |
echo "نام معتبر نیست!"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment