$text =~ /a href="(.*?)"/gi; # The ? modifier after another modifier tells perl not to be greedy in the *, stopping, here, before the first \" (instead of swallowing all the string as it would with "."