codecamp

JavaScript 使用正则表达式选取数值

// Setup
var testString = "There are 3 cats but 4 dogs.";


// Only change code below this line.


var expression = /\d+/g;// Change this line


// Only change code above this line


// This code counts the matches of expression in testString
var digitCount = testString.match(expression).length;
JavaScript 使用正则表达式操作字符串
JavaScript 使用正则表达式选取空白字符
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定