DE
use strict;
my $str = 'Create a file containing just this data:
onGlaTwqHns4p9sU36HYrGmEwompIV5GcB9kUXnLMTM.5-VMGAJ-Ns73VGuK8oiDpcVUHbW3Y_vfMMoF1VIpSDI
And make it available on your web server at this URL:
http://website.su/.well-known/acme-challenge/onGlaTwqHns4p9sU36HYrGmEwompIV5GcB9kUXnLMT';
my $regex = qr/(?<=Create a file containing just this data:\n\n)(?<filedata>[\w.-]+)(?:[\w\W]+?http:\/\/website.su\/\.well-known\/acme-challenge\/)(?<filename>\w+)/mp;
if ( $str =~ /$regex/g ) {
print "Whole match is ${^MATCH} and its start/end positions can be obtained via \$-[0] and \$+[0]\n";
# print "Capture Group 1 is $1 and its start/end positions can be obtained via \$-[1] and \$+[1]\n";
# print "Capture Group 2 is $2 ... and so on\n";
}
# ${^POSTMATCH} and ${^PREMATCH} are also available with the use of '/p'
# Named capture groups can be called via $+{name}