Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Link Matching
Re: Link Matching
[ Please provide a proper attribution when you quote someone,
like everybody else does...
I was hoping you'd say that after seeing my post. :-)
Errr, so when you said:
forget that it's HTML we're parsing
we weren't really supposed to do that?
One of the ways I did it in the code that I gave you meets
that spec. Did you read and understand that code?
Or, since your Question is Asked Frequently:
perldoc -q greedy
What does it mean that regexes are greedy? How can I get around it?
There is no "above example".
If you want to discuss a piece of code, then please quote the piece
of code, like everybody else does...
That is where managing the greediness will become difficult.
I'd stick with finding the delimiters first, and then applying
your regex to the list it returns:
my $inner_pat = 'o'; # lower case oh
my @x = grep /$inner_pat/, m#<open>(.*?)</close>#isg;
This program makes output when it matches that pattern:
$_ = 'two';
print "matched\n" if /o(.)*/;
Your regex will match the same strings as /o/
and it will fail to match the same strings.
Did you perhaps mean /o(.)+/ instead?
Tad McClellan SGML consulting
email@example.com Perl programming
Fort Worth, Texas
- » FAQ 5.21 I still don't get locking. I just want to increment the number in the file. How...
- — Previous thread in » PERL Discussions