note 17877 added to function.eregi-replace
| From: | dimy at misterdimNOSPAMPLEASE dot com | Date: | Sun, 30 Dec 2001 20:52:05 +0000 |
| Subject: | note 17877 added to function.eregi-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-23994@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
--
http://www.php.net/manual/en/function.eregi-replace.php
http://master.php.net/manage/user-notes.php?action=edit+17877
http://master.php.net/manage/user-notes.php?action=delete+17877
http://master.php.net/manage/user-notes.php?action=reject+17877