const regex = /(?<=the date is ).*?(?=\s*the place is)|(?<=the place is ).*?(?=\s*the people are)|(?<=the people are ).*/g;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('(?<=the date is ).*?(?=\\s*the place is)|(?<=the place is ).*?(?=\\s*the people are)|(?<=the people are ).*', 'g')
const str = `<a href=\\"http://vnexpress.net/tin-tuc/the-gioi/putin-noi-se-tiep-tuc-hop-tac-voi-phuong-tay-3236453.html\\"><img width=130 height=100 src=\\"http://s.f29.img.vnecdn.net/2015/06/19/pu2-2249-1434719288_180x108.jpg\\" ></a></br>Tổng thống Nga Vladimir Putin tự tin rằng hợp tác của Moscow với Phương Tây sẽ vẫn tiếp tục, bất chấp việc Liên minh châu Âu (EU) công bố sẽ kéo dài các lệnh trừng phạt thêm 6 tháng.`;
// Reset `lastIndex` if this regex is defined globally
// regex.lastIndex = 0;
let m;
while ((m = regex.exec(str)) !== null) {
// This is necessary to avoid infinite loops with zero-width matches
if (m.index === regex.lastIndex) {
regex.lastIndex++;
}
// 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