I am using this regex to be able to accept accent characters
/^([\p{L}a-zA-Z ,-]*)$/i
When i test my regex on this website : http://rubular.com/r/MRESYEGO2d everything is ok, but when i use the same regex in my php its not working.
$alphaNumCity = "/^([\p{L}a-zA-Z0-9 ,-]*)$/i";
if (preg_match($alphaNumCity, $champ)) {
echo "<label for='tags'>Villes<span style='color:red;'>*</span></label><input id='tags' name='businessVille' value='".$champ."' required />";
} else {
echo "<label for='tags'>Villes<span style='color:red;'>(entrer un nom de ville valide)*</span></label><input id='tags' name='businessVille' required />";
$valide = false;
}
This code is going in the else.
I don't understand why its working here http://rubular.com/r/MRESYEGO2d and not in my code ?