in reply to Link reg expression
it fetchs other end quotes because you are asking it to with .*. If you change your code to:
it should work. Also, you could try the non-greedy form:if ( $line =~ m/(https?:[^"]+")/ )
check perlre for more on the non-greedy quantifiers, and read this post by Ovid on the dangers of .*.if ( $line =~ m/(https?:.+?")/ )
hope this helps,
update: you should be using a module specifically designed to deal with links in html documents for this, anyway.
|
---|
In Section
Seekers of Perl Wisdom