import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Example {
public static void main(String[] args) {
final String regex = "(extralibs_)(|avutil|avcodec|avformat|avdevice|avfilter|avresample|postproc|swscale|swresample)(?==)";
final String string = "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\"\n"
+ "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\"\n"
+ "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\"\n"
+ "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\"\n"
+ "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\"\n"
+ "extralibs_avresample=\"-lm\"\n"
+ "extralibs_postproc=\"-lm\"\n"
+ "extralibs_swscale=\"-lm\"\n"
+ "extralibs_swresample=\"-lm\"\n";
final Pattern pattern = Pattern.compile(regex, Pattern.MULTILINE);
final Matcher matcher = pattern.matcher(string);
while (matcher.find()) {
System.out.println("Full match: " + matcher.group(0));
for (int i = 1; i <= matcher.groupCount(); i++) {
System.out.println("Group " + i + ": " + matcher.group(i));
}
}
}
}
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 Java, please visit: https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html