in reply to negative Lookahead or
First, this code produces that following output for me:
string: <a href="#1">HIT<b>MUST MATCH</b></a> <a href="#2">2</a> match: HIT<b>MUST MATCH</b></a> string: <a href="#1">HIT<a name="MUST NOT MATCH">-</a> <a href="#2">2< +/a> NO match!
This seems like the result you desire.
However, I would advise you do not use regexes to parse HTML, because it is very, very hard to make the regex do it correctly (especially since there can be >s or <s in comments or quoted attribute values.) It would be better HTML::Parser or HTML::TokeParser. Searches of this site should give you many examples of their use.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: negative Lookahead
by eddmund (Initiate) on Nov 12, 2001 at 08:05 UTC | |
by wog (Curate) on Nov 12, 2001 at 08:15 UTC | |
by eddmund (Initiate) on Nov 12, 2001 at 21:00 UTC |
In Section
Seekers of Perl Wisdom