Skip to content

Instantly share code, notes, and snippets.

@YaronMiro
Created May 23, 2018 13:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save YaronMiro/6d49e6a33d93fc2ef7cd32247eee4a3c to your computer and use it in GitHub Desktop.
Save YaronMiro/6d49e6a33d93fc2ef7cd32247eee4a3c to your computer and use it in GitHub Desktop.
Hebrew characters validation
<?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