Re: Cannot even come up with the beginning of a regex

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I finally solved the problem, after ditching the /b argument inpreg_replace It seems that Hebrew letters are not part of a word, sofar as /b is concerned. Here is the code for converting Hebrew finalletters in the middle of a word to normal letters, if anyone everneeds it:
$text="עברית מבולגנת";
function hebrewNotWordEndSwitch ($from, $to, $text) {   $text=preg_replace('/'.$from.'([א-ת])/u','$2'.$to.'$1',$text);   return $text;}
do {   $text_before=$text;   $text=hebrewNotWordEndSwitch("ך","כ",$text);   $text=hebrewNotWordEndSwitch("ם","מ",$text);   $text=hebrewNotWordEndSwitch("ן","נ",$text);   $text=hebrewNotWordEndSwitch("ף","פ",$text);   $text=hebrewNotWordEndSwitch("ץ","צ",$text);}   while ( $text_before!=$text );
print $text; // עברית מסודרת!
The do-while is necessary for multiple instances of letters, such as"אנני" which would start off as "אןןי". Note that there's still theproblem of acronyms with gershiim but that's not a difficult one tosolve.
Dotan Cohen
http://what-is-what.comhttp://gibberish.co.ilא-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת;
A: Because it messes up the order in which people normally read text.Q: Why is top-posting such a bad thing?

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux