note 47874 deleted from function.preg-match by colder
| From: | colder@php.net | Date: | Mon, 18 Jun 2007 18:17:29 +0000 |
| Subject: | note 47874 deleted from function.preg-match by colder | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-127585@lists.php.net to get a copy of this message | ||
Note Submitter: internet at sourcelibre dot com
----
This helped me to make a mask for all french characters. Just modify the $str in ordre to find your
mask.
<pre>
<?php
$str = "àÀâÂéÉèÈëËêÊîÎïÏôÔçÇ";
$strlen = strlen($str);
$array = array();
$mask = "/^[a-zA-Z";
for ($i = 0; $i < $strlen; $i++) {
$char = $str{$i};
$hexa = dechex(ord($char));
echo htmlentities($char)." = ". $hexa . "\n";
$array[$i] = $hexa;
$mask .= '\\x' . $hexa;
}
$mask .= " ]+$/";
echo $mask;
?>
</pre>