http://www.perlmonks.org?node_id=267296


in reply to Link reg expression

it fetchs other end quotes because you are asking it to with .*. If you change your code to:
if ( $line =~ m/(https?:[^"]+")/ )
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 .*.

hope this helps,

update: you should be using a module specifically designed to deal with links in html documents for this, anyway.