perlnewbie9292
Programmer
Hello Perl experts,
I am not sure how/or what I need to modify to make the following lines of code match on multiple matches when they occur on the same line. Right now the regex will match correctly but only match once per line. If what I am looking for occurs twice in the same line it will only match on the first one it finds.
If I have the following lines for example, I get the results shown below.
I am not sure how/or what I need to modify to make the following lines of code match on multiple matches when they occur on the same line. Right now the regex will match correctly but only match once per line. If what I am looking for occurs twice in the same line it will only match on the first one it finds.
Code:
if ( $content =~ /((https?:\/\/)?[URL unfurl="true"]www\.\S+)/gmi)[/URL] {
print "\n\tFound URL: $1\n";
}
If I have the following lines for example, I get the results shown below.
Code:
__data__
text with a link in between [URL unfurl="true"]http://www.kjfdjf.com/ldjfljdllfdjfjldjfljdljfljdljfdjfjdljfdljfdl/ljdljfl/jdleieir/ljldjljfd/[/URL] link in this line along with other text
[URL unfurl="true"]http://www.domain.com/test.html[/URL] line with 2 [URL unfurl="true"]www.google.com[/URL]
__results__
Found URL: [URL unfurl="true"]http://www.kjfdjf.com/ldjfljdllfdjfjldjfljdljfljdljfdjfjdljfdljfdl/ljdljfl/jdleieir/ljldjljfd/[/URL]
Found URL: [URL unfurl="true"]http://www.domain.com/test.html[/URL]