I have some data I would like to extract to build an object in JS but I can't find how to do with regex.
On regex101 the regex below seems to fit but it doesn't in my code...
Here is the type of data:
"TEST_firstname:john_lastname:doe_age:45"
And I would want to extract key and values (key is between "_"
and ":"
, value is between ":"
and "_"
I tried with this : (?<key>(?<=\_)(.*?)(?=\:))|(?<value>(?<=\:)(.*?)((?=\_)|$))
Could someone help me to find the good regex?