Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Regular Expression not working
- Fritz Bayer
June 15, 2005, 9:25 am
rate this thread
I'm trying to extract urls from a document.
The following code does not work correctly:
while ($content =~ m!$(<p
print "1 $1\n";
print "2 $2\n";
print "3 $3\n";
print "4 $4\n";
print "5 $5\n";
The problem is that
is also matching the character " or ' from the third capturing group,
even though it should NOT.
If matches them not because the third capturing is empty (not " or '),
but because somehow can't be used inside a [...] block.
Why is that and whats the workaround for this?
Re: Regular Expression not working
: I'm trying to extract urls from a document.
: Why is that and whats the workaround for this?
The workaround is to use the HTML::LinkExtor module from CPAN:
I also see brian d foy's HTML::SimpleLinkExtor, but I haven't
Hope this helps,
Capitalism got better press in Pravda than our Ballot Initiative
to End the Income Tax gets from the Big Boston Media.
-- Carla Howell
stats (was Re: Regular Expression not working)
: I see that you haven't posted the weekly statistics for a while. Have
: you given up on that?
A while back, I realized I'd missed a week but also noticed the
absence of any clamor over it.
Comfort rides shotgun with the temporary.
-- Daniel Weinshenker
- » FAQ 2.9 What are the Perl newsgroups on Usenet? Where do I post questions?
- — Previous thread in » PERL Discussions