@sewq Can using Execute code
function htmlToText(html) {
var str = String(html || '');
str = str.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi, '');
str = str.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi, '');
str = str.replace(/<!--[\s\S]*?-->/g, '');
str = str.replace(/<[^>]+>/g, '');
str = str.replace(/ /g, ' ');
str = str.replace(/</g, '<');
str = str.replace(/>/g, '>');
str = str.replace(/&/g, '&');
str = str.replace(/"/g, '"');
str = str.replace(/'/g, '\'');
str = str.replace(/&#(\d+);/g, function (m, n) {
return String.fromCharCode(parseInt(n, 10));
});
str = str.replace(/&#x([0-9A-Fa-f]+);/g, function (m, n) {
return String.fromCharCode(parseInt(n, 16));
});
str = str.replace(/\s+/g, ' ');
str = str.replace(/^\s+|\s+$/g, '');
return str;
}
function getCodeByKeyword(text, keyword) {
var idx = text.indexOf(keyword);
if (idx === -1) return null;
var sub = text.substring(idx + keyword.length);
var match = sub.match(/\d{6}/);
return match ? match[0] : null;
}
VAR_EMAIL_CONTENT = htmlToText(VAR_EMAIL_HTML)
var match = getCodeByKeyword(VAR_EMAIL_CONTENT, 'Your code is')
if (match) {
VAR_EMAIL_OTP = match
} else {
fail_user("Error get email otp")
}
Change 'Your code is'