I have these information in the email from which I want to extract the phone number:
Numéro de réservation: 254207287398084
Téléphone (portable): 0782375426
When I try finding 0782375426
with Regex, it works perfectly well on regex101.com with that regular expression: /0[67][0-9]{8}\b
However, this part of my script returns null
:
var msg = messages[j].getBody();
var search = "0[67][0-9]{8}\b";
var regx = new RegExp("(.)"+search+"(.)");
var y = regx.exec(msg);
Logger.log(y);
Would you know what is wrong in my code?