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

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

 



On 28/02/2008, Zoltán Németh <znemeth@xxxxxxxxxxxxxx> wrote:>  > Thank you very much, Zoltan. Is there a known UTF-8 limitation?>  > Because it works fine for me in English letters (well, the opposite of>  > what I needed but I was able to work with it as which polar I start>  > with was arbitrary), but not in Hebrew letters. For instance, this>  > works as expected:>  >>  > $test="aabacada aa a f";>  > $test=preg_replace('/\b([^\s]+)a\b.*/U', '$1A', $test);>  > print $test; // PRINTS aabacadA aA a f>  >>  > However, this does not:>  >>  > $test="אאבאגאדא אא א ";>  > $test=preg_replace('/\b([^\s]+)ע\b.*/U', '$1א', $test);>  > print $test; // PRINTS אאבאגאדא אא א>  >>  > Am I misunderstanding something, or is there a UTF-8 problem, or>  > something else? Thank you for your assistance, it is much appreciated>  > and I'm learning what I can.>>> in the above example I don't see the character-to-be-replaced in the>  original string, so I'm not surprised it does not get replaced ;)
It was supposed to be this:
$test="אאבאגאדא אא א ";$test=preg_replace('/\b([^\s]+)א\b.*/U', '$1ע', $test);print $test; // PRINTS אאבאגאדא אא א
But I reversed them while trying a string of different letters, andapparently only CTRL-Z'ed part of the code before copying to here.Sorry. The code above also does not work. Not on my server, and not atspaweditor.com (Thanks for that resource, by the way). You can see theresult and the exact code used here:http://gibberish.co.il/test.html
>  you can test the regex further here:>  http://www.spaweditor.com/scripts/regex/index.php
Thanks, that is a great resource.
>  I pasted your data in there (don't be surprised that after posting it>  turns them into html entities), replaced the last character to the one>  in the regex and the preg_replace worked
Not for me. These are my parameters:
Enter regular expression here: /\b([^\s]+)א\b.*/UEnter your data here: אאבאגאדא אא א חEnter text to replace matches with here: (backreferences are ok): $1עRegular expression options: PERLFunction: preg_replaceFlags: 0 limit
I really appreciate the help.
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