codecamp

JavaScript 使用正则表达式选取空白字符

// Setup
var testString = "How many spaces are there in this sentence?";


// Only change code below this line.


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


// Only change code above this line


// This code counts the matches of expression in testString
var spaceCount = testString.match(expression).length;
JavaScript 使用正则表达式选取数值
JavaScript 使用正则表达式转化匹配
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定