develooper Front page | perl.beginners | Postings from April 2010

Reg Exp: Extract from last appearance of A to first appearance B

Thread Next
From:
HolyNoob
Date:
April 27, 2010 00:52
Subject:
Reg Exp: Extract from last appearance of A to first appearance B
Message ID:
z2oac0aefd71004270052y5941cf70lc7362900e210bda0@mail.gmail.com
Hi,

I'm trying to make a regexp to match the last appearance of a word (lets say
'abc') until the first appearance of another word (for ex: 'xyz'), and I
still cannot do it.

For example: with a string like this "abc abc abc toto toto xyz xyz xyz" ,
which regexp I have to use to get "abc toto toto xyz".
I can extract this "abc abc abc toto toto xyz" with   m/abc(.*?)xyz/
but still got a problem to have exactly what I need.

Would you guys please help me?

Thank you very much

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About