JSFiddle - React, Tailwind, and code Playground

JavaScript

var re = /\r\n\|\n\r|\r|\n/g,
    str = "aa\rbb\r",
    match,
    results = [];

do {
    match = re.exec(str);
    if (match)
        results.push(match[1]);
} while (match);



document.write('<pre>' + 
               JSON.stringify(results, null, 4) +
               '</pre>')