const regex = new RegExp('(?ms)^\\s{,20}\\d.*?(?=^\\s{,20}\\d|\\Z)', 'gm')
const str = ` BID RANK BID TOTAL BIDDER ID BIDDER INFORMATION (NAME/ADDRESS/LOCATION)
-------- ----------- --------- -------------------------------------------------
1 1,486,399.87 5 ORTIZ ASPHALT PAVING INC 909 386-1200 SB PREF CLAIMED
00814766
P O BOX 883 FAX 909 386-1288
COLTON CA 92324
2 1,534,243.00 3 EXCEL PAVING COMPANY 562 599-5841 SB PREF CLAIMED
00688659
2230 LEMON AVENUE FAX 562 591-7485
LONG BEACH CA 90806
3 1,593,549.40 2 SECURITY PAVING COMPANY INC 818 767-8418 CC PREF CLAIMED
00116307
P O BOX 1489 FAX 818 767-3169
SUN VALLEY CA 91353-1489`;
// 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