[英]Extracting digits from a regular expression
var myString = 'Sent from your Zoom trial account - Your verification code is: 621226';
var regEx = /(\d+)$/g;
var result = regEx.exec(myString);
但是結果= [621226,621226]而不是[621226]
使用.match()
和regEx
作為鏈接到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);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.