const regex = /\d{2,5}x\d{2,5}/;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('\\d{2,5}x\\d{2,5}', '')
const str = `Copyright (c) 2000-2015 the FFmpeg developers built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-11) configuration: --prefix=/usr/local/cpffmpeg --enable-shared --enable-nonfree --enable-gpl --enable-pthreads --enable-libopencore-amrnb --enable-decoder=liba52 --enable-libopencore-amrwb --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --extra-cflags=-I/usr/local/cpffmpeg/include/ --extra-ldflags=-L/usr/local/cpffmpeg/lib --enable-version3 --extra-version=syslint libavutil 54. 19.100 / 54. 19.100 libavcodec 56. 26.100 / 56. 26.100 libavformat 56. 23.106 / 56. 23.106 libavdevice 56. 4.100 / 56. 4.100 libavfilter 5. 11.102 / 5. 11.102 libswscale 3. 1.101 / 3. 1.101 libswresample 1. 1.100 / 1. 1.100 libpostproc 53. 3.100 / 53. 3.100Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/var/zpanel/hostdata/zadmin/public_html/chandelier.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 URL : Follow Me On > www.hamhame1.in compilation : 0 title : Follow Me On > www.hamhame1.in artist : Follow Me On > www.hamhame1.in album : Follow Me On > www.hamhame1.in date : Follow Me On > www.hamhame1.in genre : Follow Me On > www.hamhame1.in comment : Follow Me On > www.hamhame1.in composer : Follow Me On > www.hamhame1.in original_artist : Follow Me On > www.hamhame1.in copyright : Follow Me On > www.hamhame1.in encoder : Follow Me On > www.hamhame1.in album_artist : Follow Me On > www.hamhame1.in season_number : 0 episode_sort : 0 track : 0 disc : 0 media_type : 0 Duration: 00:03:51.35, start: 0.000000, bitrate: 2778 kb/s Stream 0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 > DAR 16:9], 2646 kb/s, 23.98 fps, 23.98 tbr, 90k tbn, 47.95 tbc (default) Metadata: handler_name : VideoHandler Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default) Metadata: handler_name : SoundHandlerAt least one output file must be specified`;
// Reset `lastIndex` if this regex is defined globally
// regex.lastIndex = 0;
let m;
if ((m = regex.exec(str)) !== null) {
// The result can be accessed through the `m`-variable.
m.forEach((match, groupIndex) => {
console.log(`Found match, group ${groupIndex}: ${match}`);
});
}
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 JavaScript, please visit: https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Regular_Expressions