use strict;
my $str = '[null,null,null](img-1 \'https://cdnapi.ergolab.cn/api/cdn/files/Teams/Picture/1/2670fff8-2119-c821-d2e6-3a04b72ac556/jsjuHxumPt4yKPRtVfR.png\')
[null,null,null](img-1 \'https://cdnapi.ergolab.cn/api/cdn/files/Teams/Picture/0/2670fff8-2119-c821-d2e6-3a04b72ac556/jsjuHxumPt4yLavx4gv.png\')
[null,null,null](img-1 \'https://cdnapi.ergolab.cn/api/cdn/files/MaterialLibrary/Picture/0/3761f21b-3016-dadd-6198-3a0569770f55/jsjuHxukkZDtF879nQB.jpg\')
[](audio-1 \'https://cdnapi.ergolab.cn/api/cdn/files/Teams/Audio/0/2670fff8-2119-c821-d2e6-3a04b72ac556/jsjuHxumPt4zfnkYB6m.ogg\')
[](audio-1 \'https://cdnapi.ergolab.cn/api/cdn/files/MaterialLibrary/Audio/0/44b29ef1-e567-e1a4-49c6-3a0545afd2f4/jsjuHidHpFagk8AbHt7.mp3\')
[](video-1 \'https://cdnapi.ergolab.cn/api/cdn/files/Teams/Video/0/2670fff8-2119-c821-d2e6-3a04b72ac556/jsjuHxumPt4zfnoXzSB.ogg\')
[](video-1 \'https://cdnapi.ergolab.cn/api/cdn/files/MaterialLibrary/Video/0/ac35f3ad-4cbb-da07-e510-39fd24ba71b5/jseEvLjEA4JXbybZQse.mp4\')';
my $regex = qr/(\[.*\]\(audio-1 .*\))|(\[.*\]\(img-1 .*\))|(\[\]\(video-1 .*\))/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}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Perl, please visit: http://perldoc.perl.org/perlre.html