I am dealing with a string that looks like this:
const myString = '[12m[99mSOME STRING 1: [bla[bla[88mSOMETHING 2[00m['
My goal is to extract "SOME STRING 1"
and "SOMETHING 2"
from this string and store them in separate variables. The string will always have the same structure, except for the parts containing "SOME STRING 1"
and "SOMETHING 2"
.
Since the specific content of "SOME STRING 1"
and "SOMETHING 2"
may vary, I cannot simply use includes('SOME STRING 1')
here.
The first needed string is everything between [99m
and :
.
The second needed string is everything between [88m
and [
.
Desired outcome:
const string1 = 'SOME STRING 1'
const string2 = 'SOMETHING 2'