const regex = /
6,12/2/2020,2750,45,0,BLUE GRASS 3.3 EDP SPY,484477,16,6036,ELIZABETH ARDEN,168,1436.4,0,0,10/27/2020,11/16/2020,12/22/2020,12/29/2020,12/29/2021,January,1/5/2021,16C,703,no,0,0,no,11/16/2020,,NA,NA,VA-ROANOKE,Y,,FL,USA,DELAYNE WILDERMUTH,D,00612-BB-Beauty Boutique,168,1436.4,"BB REQUESTING SAMPLES OF EACH SKU. ANY QUESTIONS CONTACT JEN @2435./g;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('
6,12\/2\/2020,2750,45,0,BLUE GRASS 3.3 EDP SPY,484477,16,6036,ELIZABETH ARDEN,168,1436.4,0,0,10\/27\/2020,11\/16\/2020,12\/22\/2020,12\/29\/2020,12\/29\/2021,January,1\/5\/2021,16C,703,no,0,0,no,11\/16\/2020,,NA,NA,VA-ROANOKE,Y,,FL,USA,DELAYNE WILDERMUTH,D,00612-BB-Beauty Boutique,168,1436.4,"BB REQUESTING SAMPLES OF EACH SKU. ANY QUESTIONS CONTACT JEN @2435.', 'g')
const str = `Stop
> quote
keep quoting
Stop
Stop
> quote
> keep quoting
>
keep quoting
> keep > quoting
> keep quoting
Stop
>quote
> keep quoting
Stop
`;
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