use strict;
my $str = 'extralibs_avutil="-pthread -lva-drm -lva -lvdpau -lX11 -lm -L/usr/lib64/valgrind -ldrm -lm -lcoregrind-amd64-linux -lvex-amd64-linux -lgcc -lmfx -lstdc++ -ldl -lOpenCL -lva -ldl"
extralibs_avcodec="-lvpx -lm -lpthread -lvpx -lm -lpthread -lvpx -lm -lpthread -lvpx -lm -lpthread -lwebpmux -lm -lwebp -lm -pthread -pthread -lm -llzma -ldav1d -pthread -ldl -lsnappy -lstdc++ -lz -laom -lm -lpthread -lfdk-aac -lm -lgsm -lmp3lame -lm -lopenjp2 -lm -lopus -lm -lspeex -lm -ltheoraenc -ltheoradec -logg -lvorbis -lm -logg -lvorbisenc -lvorbis -lm -logg -lwebp -lm -pthread -lx264 -lpthread -lm -ldl -L/usr//usr/lib64 -lx265 -lstdc++ -lm -lgcc_s -lgcc -lgcc_s -lgcc -lrt -ldl -lnuma -lxvidcore -lva -ldl -lmfx -lstdc++ -ldl"
extralibs_avformat="-lm -lxml2 -lz -llzma -lm -lbz2 -lvapoursynth-script -lpython3.8 -lcrypt -lpthread -ldl -lutil -lm -lvapoursynth -lzimg -ldl -lzimg -lstdc++ -lbluray -ldl -lpthread -lxml2 -lz -llzma -lm -lfontconfig -luuid -lexpat -lfreetype -lbz2 -lpng16 -lm -lz -lm -lz -lharfbuzz -lm -lglib-2.0 -pthread -lpcre -pthread -lgraphite2 -lbrotlidec -lbrotlicommon -lz -lssl -lcrypto -lz -ldl -pthread -lrtmp -lz -lgmp -lgnutls -pthread -lgmp -lunistring -latomic -ltasn1 -lidn2 -lp11-kit -lhogweed -lgmp -lnettle -lsrt -lstdc++ -lm -lgcov -lgcc_s -lgcc -lpthread -lc -lgcc_s -lgcc -lssl -lcrypto -lz -ldl -pthread"
extralibs_avdevice="-lm -L/usr/lib64/valgrind -ldrm -lm -lcoregrind-amd64-linux -lvex-amd64-linux -lgcc -lxcb -lXau -lXdmcp -lxcb-shm -lxcb -lXau -lXdmcp -lxcb-shape -lxcb -lXau -lXdmcp -lxcb-xfixes -lxcb-render -lxcb-shape -lxcb -lXau -lXdmcp -lGL"
extralibs_avfilter="-pthread -lm -lfribidi -lass -lm -lfontconfig -luuid -lexpat -lfribidi -lfreetype -lbz2 -lpng16 -lm -lz -lm -lz -lharfbuzz -lm -lglib-2.0 -pthread -lpcre -pthread -lgraphite2 -lbrotlidec -lbrotlicommon -lnppig -lnppicc -lnppc -lnppidei -lva -lvidstab -lm -lgomp -lpthread -lzimg -lstdc++ -lOpenCL -lfontconfig -luuid -lexpat -lfreetype -lbz2 -lpng16 -lm -lz -lm -lz -lharfbuzz -lm -lglib-2.0 -pthread -lpcre -pthread -lgraphite2 -lbrotlidec -lbrotlicommon -lfreetype -lbz2 -lpng16 -lm -lz -lm -lz -lharfbuzz -lm -lglib-2.0 -pthread -lpcre -pthread -lgraphite2 -lbrotlidec -lbrotlicommon -ldl -lmfx -lstdc++ -ldl"
extralibs_avresample="-lm"
extralibs_postproc="-lm"
extralibs_swscale="-lm"
extralibs_swresample="-lm"
';
my $regex = qr/(extralibs_)(|avutil|avcodec|avformat|avdevice|avfilter|avresample|postproc|swscale|swresample)(?==)/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