2008. 02. 28, csütörtök keltezéssel 11.23-kor Dotan Cohen ezt írta: > 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, and > apparently 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 at > spaweditor.com (Thanks for that resource, by the way). You can see the > result 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.*/U > Enter your data here: אאבאגאדא אא א ח > Enter text to replace matches with here: (backreferences are ok): $1ע > Regular expression options: PERL > Function: preg_replace > Flags: 0 limit strange, now for a second try it did not work for me either... maybe I confused some hebrew letters last time... with html entities it won't work, as a html entity is a set of characters for the regex interpreter. anyone utf8 experts in here? I've run out of ideas... greets, Zoltán Németh > > I really appreciate the help. > > Dotan Cohen > > http://what-is-what.com > http://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? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php