How would I match the text that's after "#ab cd ef#" and before "#qr
st uv#" in the following string? I want to use a regular expression
that has both a look-behind and a look-ahead together. Is this
possible?
#ab cd ef#gh ij kl#qr st uv#
I don't know what problems you are anticipating, so I'll just try doing it
in a straightforward manner:
use strict;
"#ab cd ef#gh ij kl#qr st uv#" =~
/(?<=#ab cd ef#)(.*?)(?=#qr st uv#)/ or die;
print $1
__END__
gh ij kl
Yep, seems to work. Which is what I expected, because the parts of Perl's
regex language are supposed to work when used together--if they didn't
there wouldn't be much point in having such a language. Neither look ahead
nor look behind claim to be an experimental features, so I'd just
storm ahead and use them with confidence.
Xho
--
--------------------
http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.