const regex = /\s+([\d]+[*]*[\.]*[\d]*[\.]*[\d]*)/gm;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('\\s+([\\d]+[*]*[\\.]*[\\d]*[\\.]*[\\d]*)', 'gm')
const str = `PORO -- Generated : Petrel
-- Property name in Petrel : PHIT_Object Cutoff60
28*0.00 0.03 0.03 9502*0.00 0.01 0.01 9502*0.00 0.01 0.01 9502*0.00 0.02 0.02 9502*0.00 0.02 0.01 9502*0.00 0.03 0.02 0.00 0.00
9500*0.00 0.02 0.03 9502*0.00 0.03 0.02 9502*0.00 0.03 0.03 9502*0.00 0.01 0.01 9502*0.00 0.01 0.01 0.02 9501*0.00 0.01 0.01 0.01
9501*0.00 0.02 0.03 0.02 9501*0.00 0.01 0.01 0.01 9501*0.00 0.02 0.02 0.02 9501*0.00 0.02 0.02 0.02 9501*0.00 0.01 0.02 0.02 0.00
9500*0.00 0.01 0.02 0.02 9501*0.00 0.01 0.01 0.01 9501*0.00 0.02 0.02 0.02 9501*0.00 0.03 0.02 0.02 5*0.00 0.03 0.03 0.00 0.00
9492*0.00 0.04 0.04 0.04 5*0.00 0.03 0.01 9494*0.00 0.01 0.02 0.02 5*0.00 0.02 0.02 9494*0.00 0.01 0.02 0.01 0.00 0.00 0.00 0.00
0.00 0.01 0.02 0.02 9493*0.00 0.01 0.01 0.01 5*0.00 0.01 0.01 0.01 9493*0.00 0.03 0.04 0.02 0.02 0.00 0.00 0.00 0.00 0.02 0.03
0.03 9493*0.00 0.01 0.01 0.01 0.01 0.00 0.00 5*0.01 9499*0.00 5*0.02 9493*0.00 0.03 0.03 0.03 0.04 0.00 0.00 0.03 0.02 0.02 0.02
0.02 9493*0.00 0.03 0.02 0.01 0.01 0.00 6*0.01 9493*0.00 0.01 0.01 0.01 0.02 0.00 0.01 0.01 0.01 0.01 0.02 0.02 0.00 0.00 0.00
9490*0.00 0.03 0.03 0.02 0.02 0.00 0.01 0.02 0.01 0.02 0.01 0.02 9494*0.00 0.03 0.01 0.01 0.00 0.01 0.01 0.01 0.01 0.02 0.02 0.00
9492*0.00 0.03 0.03 0.02 0.02 0.02 0.01 0.01 0.02 0.02 0.01 0.03 9493*0.00 0.02 0.02 0.02 8*0.01 9493*0.00 0.03 0.03 0.02 0.02
0.01 0.01 0.02 0.02 0.02 0.02 0.03 9493*0.00 5*0.02 0.01 0.01 0.01 0.01 0.02 0.03 9494*0.00 0.03 0.01 0.02 0.03 0.02 0.02 0.03
0.02 0.02 0.03 0.02 9496*0.00 0.01 0.01 0.01 0.01 0.00 0.00 0.02 0.03 9496*0.00 0.02 0.01 0.02 0.01 0.03 0.03 0.03 0.01 0.00 0.00
9495*0.00 0.01 0.00 0.01 0.01 0.01 0.02 0.01 0.01 9500*0.00 0.01 0.01 9495*0.00 0.02 0.03 0.01 0.01 0.02 0.01 0.02 0.02 0.03 0.03
0.03 421*0.00 0.03 53*0.00 0.06 2560*0.00 0.06 53*0.00 0.05 6402*0.00 0.02 0.02 0.03 0.02 0.03 0.02 0.02 0.03 0.03 0.03 0.03 0.00
420*0.00 0.06 53*0.00 0.07 2560*0.00 0.06 53*0.00 0.04 6402*0.00 0.03 0.04 0.03 5*0.02 0.03 0.03 0.03 421*0.00 0.07 0.00 0.00 0.00
50*0.00 0.07 2560*0.00 0.06 53*0.00 0.05 6402*0.00 0.02 0.02 0.03 0.02 0.02 0.01 0.02 0.02 0.03 0.03 0.03 421*0.00 0.05 0.00 0.00
51*0.00 0.06 2560*0.00 0.07 6456*0.00 0.01 0.04 0.03 0.01 0.02 0.00 0.00 0.02 0.02 0.02 0.01 421*0.00 0.06 0.00 0.00 0.00 0.00
49*0.00 0.07 2560*0.00 0.08 53*0.00 0.07 53*0.00 0.06 6348*0.00 0.03 0.03 0.03 0.00 0.00 0.00 0.00 0.02 0.02 0.02 0.01 0.00 0.00
419*0.00 0.06 53*0.00 0.07 2560*0.00 0.08 53*0.00 0.07 6402*0.00 0.04 0.04 0.04 5*0.00 0.03 0.03 0.03 421*0.00 0.05 0.00 0.00 0.00
50*0.00 0.06 2506*0.00 0.06 53*0.00 0.05 53*0.00 0.06 6402*0.00 0.01 8*0.00 0.03 476*0.00 0.06 2506*0.00 0.07 0.00 0.00 0.00 0.00
49*0.00 0.06 53*0.00 0.05 53*0.00 0.04 6508*0.00 0.01 108*0.00 0.02 162*0.00 0.05 53*0.00 0.06 2506*0.00 0.06 0.00 0.00 0.00 0.00
49*0.00 0.05 53*0.00 0.06 9395*0.00 0.08 6509*0.00 9*0.01 45*0.00 0.01 106*0.00 0.01 108*0.00 0.02 162*0.00 0.04 0.00 0.00 0.00
50*0.00 0.05 53*0.00 0.02 1712*0.00 0.02 7248*0.00 0.02 0.01 0.02 0.02 0.01 0.03 0.03 0.03 46*0.00 0.04 0.01 0.00 0.00 0.00 0.00
0.00 0.00 0.02 99*0.00 0.01 108*0.00 0.01 77*0.00 0.03 53*0.00 0.04 30*0.00 0.05 53*0.00 0.06 53*0.00 0.03 0.00 0.00 0.00 0.00
157*0.00 0.04 1550*0.00 0.03 102*0.00 0.03 636*0.00 0.07 53*0.00 0.08 6454*0.00 0.01 0.01 0.01 0.01 0.00 0.00 0.00 0.01 0.01 0.01
44*0.00 0.01 0.01 6*0.00 0.01 0.01 98*0.00 0.01 108*0.00 0.01 77*0.00 0.01 53*0.00 0.02 30*0.00 0.04 53*0.00 0.04 0.00 0.00 0.00
50*0.00 0.02 161*0.00 0.04 1550*0.00 0.05 102*0.00 0.05 636*0.00 0.07 53*0.00 0.07 53*0.00 0.06 6400*0.00 0.02 0.02 0.01 0.02 0.00
0.00 0.00 0.00 0.01 45*0.00 0.03 0.01 6*0.00 0.01 0.01 0.02 0.02 96*0.00 0.01 108*0.00 0.03 162*0.00 0.03 53*0.00 0.04 0.00 0.00
51*0.00 0.02 107*0.00 0.02 53*0.00 0.05 1550*0.00 0.02 102*0.00 0.03 636*0.00 0.10 2754*0.00 0.02 3753*0.00 0.01 0.01 0.01 0.02
0.02 0.01 0.00 0.00 0.01 45*0.00 0.02 0.01 6*0.00 0.01 99*0.00 0.01 108*0.00 0.02 162*0.00 0.05 53*0.00 0.07 0.00 0.00 0.00 0.00
49*0.00 0.04 107*0.00 0.04 53*0.00 0.07 1550*0.00 0.02 102*0.00 0.04 0.03 635*0.00 0.08 53*0.00 0.07 53*0.00 0.06 0.00 0.00 0.00
50*0.00 0.05 269*0.00 0.05 53*0.00 0.05 2268*0.00 0.03 53*0.00 0.03 3699*0.00 0.03 0.03 0.02 0.02 0.02 0.02 0.03 0.02 0.00 0.00
44*0.00 0.03 0.02 106*0.00 0.01 108*0.00 0.02 162*0.00 0.05 53*0.00 0.06 53*0.00 0.05 107*0.00 0.03 53*0.00 0.05 0.00 0.00 0.00
1650*0.00 0.04 636*0.00 0.07 53*0.00 0.08 53*0.00 0.05 53*0.00 0.04 323*0.00 0.04 6022*0.00 0.02 0.02 0.01 0.02 0.02 0.02 0.02
0.02 0.02 0.01 0.03 43*0.00 0.03 0.02 0.00 0.01 0.01 0.00 0.00 0.00 0.02 0.01 0.02 0.02 96*0.00 0.01 108*0.00 0.03 0.00 0.00 0.00
128*0.00 0.02 30*0.00 0.07 53*0.00 0.05 53*0.00 0.04 107*0.00 0.04 53*0.00 0.06 1653*0.00 0.03 690*0.00 0.06 0.00 0.00 0.00 0.00
49*0.00 0.04 53*0.00 0.05 269*0.00 0.04 53*0.00 0.04 2268*0.00 0.02 53*0.00 0.02 539*0.00 0.02 53*0.00 0.03 0.03 0.00 0.00 0.00
49*0.00 0.05 0.04 52*0.00 0.04 0.04 52*0.00 0.04 701*0.00 0.03 53*0.00 0.03 2187*0.00 0.01 0.01 0.02 0.02 0.02 0.02 0.00 0.01 0.00
0.01 0.03 43*0.00 0.03 0.01 0.00 0.01 0.01 0.00 0.00 0.00 0.00 0.01 0.02 0.03 96*0.00 0.01 108*0.00 0.04 131*0.00 0.02 0.00 0.00
28*0.00 0.04 53*0.00 0.05 53*0.00 0.03 107*0.00 0.02 53*0.00 0.05 5045*0.00 0.02 593*0.00 0.02 53*0.00 0.01 0.01 0.00 0.00 0.00
49*0.00 0.02 0.02 52*0.00 0.01 0.02 52*0.00 0.01 2943*0.00 0.04 0.04 0.00 0.03 0.02 0.02 0.00 0.02 0.00 0.02 0.00 0.00 0.00 0.00
40*0.00 0.05 0.03 0.00 0.02 0.02 0.00 0.00 0.00 0.00 0.02 0.03 97*0.00 0.02 108*0.00 0.03 162*0.00 0.05 53*0.00 0.07 0.00 0.00
51*0.00 0.05 107*0.00 0.04 53*0.00 0.06 5639*0.00 0.03 54*0.00 0.02 53*0.00 0.03 52*0.00 0.03 0.03 52*0.00 0.02 0.00 0.00 0.00 /`;
// 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