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

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

 



2008. 02. 28, csütörtök keltezéssel 00.02-kor Dotan Cohen ezt írta:
> On 27/02/2008, Zoltán Németh <znemeth@xxxxxxxxxxxxxx> wrote:
> >
> > sorry that's messed up a bit, as I typed it right here in my mailer ;)
> >
> >  preg_replace('/\b([^\s]+)a\b.*/U', '$1A', 'whatever i want that hasa a
> >  on the end');
> >
> >  greets
> >
> > Zoltán Németh
> >
> 
> 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 ;)

you can test the regex further here:
http://www.spaweditor.com/scripts/regex/index.php

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

greets
Zoltán Németh

> 
> 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


[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