Hi Team,
I am running one Rest API which gives response as below:
[
{
"message": "You can use the OTP 79744 to login to your account. Use it within 3 minutes before it expires. Please do not share this OTP with anyone."
}
]
So how to extract OTP values in one variable, specifically via regular expression?
However, via JS string function, I can achieve it but wanted to do it via regular expression
let str = `You can use the OTP 79744 to login to your account. Use it within 3 minutes before it expires. Please do not share this OTP with anyone.`;
let substring = str.substring(20,26);
console.log(substring);
I can further utilize the substring variable which contains the OTP values.
Thanks