const regex = /src: \"[^\>]*\"\}/;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('src: \\"[^\\>]*\\"\\}', '')
const str = `<![CDATA[
var playerInstance = new artiplayer('artimedia-player-0404-1',{
source: {type: "video/mp4", src: "https://www.lolka.co.il/wp-content/uploads/2018/12/Screen-Shot-2018.jpg"},
poster: "https://www.lolka.co.il/wp-content/uploads/2018/12/Screen-Shot-2018-12-28-at-15.46.29-e1546004840977.png",
autoplay: false,
sitekey: '0404',
category: "test src: "varffff1"
});
]]>
[1]: <![CDATA[
var playerInstance = new artiplayer('artimedia-player-0404-3',{
source: {type: "video/mp4", src: "https://www.0404.co.il/wp-content/uploads/2019/01/WhatsApp-Video-2019-01-07-at-08.33.38.mp4"},
poster: "https://www.0404.co.il/wp-content/uploads/2019/01/WhatsApp-Image-2019-01-07-at-08.38.27.jpeg",
autoplay: false,
sitekey: '0404',
category: "test"
});
]]>`;
// 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