I have a string like below. const myString =
"{
"typ": "JWT",
"alg": "44555"
}
{
"XForwardedFor": "12.134.234.22",
"sm_AppId": "test",
"UserId": "changu",
"sm_Userdn": "some userdn",
"Mail": "[email protected]",
"DomainName": "www.test.com",
"UserAgent": "Amazon",
"CreationTime": "2020-09-08T05:01:55.616Z"
}
ii( NJm)'d=IXp:$uG\mf }"
I need to get userID and Mail from the above using regex. How can I achieve it. I tried with below regex code but didnt find luck.
myString.match(/"UserId":"([\s\S]*?)"/i);
"(?:UserId|Mail)"\s*:\s*"([^"]+)"might help