const regex = /redirect_url%2522%253A%2522([^>]+)%252F%253F/gm;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('redirect_url%2522%253A%2522([^>]+)%252F%253F', 'gm')
const str = `https://ue.flipboard.com/usage?data=%257B%2522prod_type%2522%253A%2522notification%2522%252C%2522event_category%2522%253A%2522email%2522%252C%2522event_action%2522%253A%2522click%2522%252C%2522event_data%2522%253A%257B%2522type%2522%253A%252210today.ad3li.20200116.421.1%2522%252C%2522target_id%2522%253A%2522art5678910%252F0%2522%252C%2522url%2522%253A%2522https%253A%252F%252Fwww.washingtonpost.com%252Fgraphics%252F2020%252Fentertainment%252Fnotre-dame-history%252F%2522%252C%2522method%2522%253A%2522externalweb%2522%252C%2522redirect_url%2522%253A%2522https%253A%252F%252Fwww.washingtonpost.com%252Fgraphics%252F2020%252Fentertainment%252Fnotre-dame-history%252F%253Futm_medium%253D10today.ad3li.20200116.421.1%2526utm_source%253Demail%2526utm_content%253Darticle%2526utm_campaign%253D10-for-today---4.0-styling%2522%257D%252C%2522properties%2522%253A%257B%2522uid%2522%253A%25224141481%2522%252C%2522unique_id%2522%253A%25224141481%2522%252C%2522time%2522%253A1579245285471%252C%2522ab_tests%2522%253A%2522421_1%2522%257D%257D`;
// 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