const regex = new RegExp('(S\\w.*\\d[:])|(([0-9.]+|(-[0-9.]+)))|([A-Z]{2}\\b)', 'gm')
const str = `ACTIONS:
[ { LONGITUDES:
{ SHUTTLE_LON_A6: [ 748, [ 'CI', 76.5, 980.5 ] ],
SHUTTLE_LON_A5:
[ 271,
[ 'CL', 0, 76.5 ],
[ 'CI', 76.5, 980.5 ],
[ 'CL', 980.5, 1057 ] ],
SHUTTLE_LON_A4: [ 129 ],
SHUTTLE_LON_A3: [ 107 ],
SHUTTLE_LON_A2: [ -35 ],
SHUTTLE_LON_A1: [ -57 ] },
LATITUDES: { SHUTTLE_LAT_1: [ [ 1057 ] ] } },
{ LONGITUDES:
{ SHUTTLE_LON_A6: [ 978, [ 'CL', 76.5, 980.5 ] ],
SHUTTLE_LON_A5:
[ 727,
[ 'CL', 0, 76.5 ],
[ 'CI', 76.5, 980.5 ],
[ 'CL', 980.5, 1057 ] ],
SHUTTLE_LON_A4: [ 250, [ 'CI', 76.5, 980.5 ] ],
SHUTTLE_LON_A3: [ 20, [ 'CL', 76.5, 980.5 ] ],
SHUTTLE_LON_A2: [ -122 ],
SHUTTLE_LON_A1: [ -144 ] },
LATITUDES:
{ SHUTTLE_LAT_1:
[ [ 20.5, [ 'CI', 0, 1100 ] ],
[ 34.5, [ 'CI', 0, 1100 ] ],
[ 58.5, [ 'CI', 0, 1100 ] ],
[ 76.5,
[ 'CL', 0, 271 ],
[ 'CI', 271, 727 ],
[ 'CL', 727, 1100 ] ],
[ 980.5,
[ 'CL', 0, 271 ],
[ 'CI', 271, 727 ],
[ 'CL', 727, 1100 ] ],
[ 998.5, [ 'CI', 0, 1100 ] ],
[ 1022.5, [ 'CI', 0, 1100 ] ],
[ 1036.5, [ 'CI', 0, 1100 ] ],
[ 1057, [ 'CL', 0, 1100 ] ],
[ 1057 ] ] } } ] } ]`;
// 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