note 17877 deleted from function.eregi-replace by jimw
| From: | jimw@php.net | Date: | Wed, 02 Jan 2002 11:59:11 +0000 |
| Subject: | note 17877 deleted from function.eregi-replace by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-24249@lists.php.net to get a copy of this message | ||
Note for french people who wants to match "é", "ê"...
For example, if you want to underline words "noël" or "noel" (notice the
difference between "e" and "ë") in a text.
Let say the text to be underlined is $search, the text you look into is $text
<P>
$myRegExp = $search;
$myRegExp = eregi_replace("(e|é|è|ê|ë)", "(e|é|è|ê|ë)", $myRegExp);
$myRegExp = eregi_replace("(a|à|â|ä|ã)", "(a|à|â|ä|ã)", $myRegExp);
$myRegExp = eregi_replace("(o|ô|ö|õ)", "(o|ô|ö|õ)", $myRegExp);
$resultString = eregi_replace("($myRegExp)", "<U>\\1</U>", $text);
</P>
Notice that even if the 2 first args of eregi seems to be the same ("(o|ô|ö|õ)",
"(o|ô|ö|õ)"), the first one is ereg and the second is a string!...
So if $search is "noel" or "noël" or "noél" or ..., all the words
"noel" or "noël" or "noél" found in $text... will be underlined in
the result string!
I hope you'll understand my English!... If foreign users could merge this comment to add
special chars, it could be nice... I think for example at the "ñ" that can be replaced by
"n" for spannish users...
Hope it will help you
Dim