[Israel.pm] regex question

Amir E. Aharoni amir.aharoni at mail.huji.ac.il
Tue Jan 5 05:24:38 PST 2010


On Tue, Jan 5, 2010 at 14:39, Yossi Itzkovich
<Yossi.Itzkovich at ecitele.com> wrote:
>
> Hi,
> I need to catch a text between, for example, the word "myWord" and a word which is not "myWord".
> I can do it like :  m~\bmyWord\b(.+?)\b[^m][^y][^W][^o][^r][^d]\b~  but I guess there is a much better alternative.
>
> Thanks in advance

I am not sure that i completely understood what you want to
accomplish. Can you send some examples of string that should and
should not match?

In any case, it sounds like you're searching for Look-Around
Assertions, which i use very often. Take a look at:

http://perldoc.perl.org/perlre.html#Look-Around-Assertions

--
אָמִיר אֱלִישָׁע אַהֲרוֹנִי
Amir Elisha Aharoni

http://aharoni.wordpress.com

"We're living in pieces,
I want to live in peace." - T. Moore


More information about the Perl mailing list