Created
May 23, 2018 13:11
-
-
Save YaronMiro/6d49e6a33d93fc2ef7cd32247eee4a3c to your computer and use it in GitHub Desktop.
Hebrew characters validation
This file contains hidden or 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 | |
// validate that the provider name contians only "hebrew" characters. | |
if (!preg_match("/^\p{Hebrew}+$/u", str_replace(' ', '', $element['#value']))) { | |
$error_message = t('שם ספק יכול להכיל אך ורק תווים בעברית'); | |
form_set_error($element['#name'], $error_message); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment