var myString = 'Sent from your Zoom trial account - Your verification code is: 621226';
var regEx = /(\d+)$/g;
var result = regEx.exec(myString);
However result = [621226, 621226] instead of just [621226]
Use .match()
with regEx
as parameter chained to myString
.
var myString = 'Sent from your Zoom trial account - Your verification code is: 621226'; var regEx = /(\\d+)$/g; var result = myString.match(regEx); console.log(result);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.