正则关卡13:匹配出现零次或多次的字符

正则表达式测试工具

+用来查找出现一次或多次的字符。
​可以匹配出现零次或多次的字符。
例如:

var soccerWord = "gooooooooal!";
var gPhrase = "gut feeling";
var oPhrase = "over the moon";
var goRegex = /go*/;
console.log( soccerWord.match(goRegex) ); // 返回 ["goooooooo"]
console.log( gPhrase.match(goRegex) ); // 返回 ["g"]
console.log( oPhrase.match(goRegex) ); // 返回 null

闯关:创建一个变量为chewieRegex的正则表达式,使用*符号在chewieQuote中匹配"A"及其之后出现的零个或多个"a"

注意: 你的正则表达式不需要使用修饰符,也不需要匹配引号。

var chewieQuote = "Aaaaaaaaaaaaaaaarrrgh!";
var chewieRegex = /change/; // 修改这行代码
var result = chewieQuote.match(chewieRegex);
console.log(result);

正确代码

var chewieQuote = "Aaaaaaaaaaaaaaaarrrgh!";
var chewieRegex = /Aa*/g;
var result = chewieQuote.match(chewieRegex);
console.log(result);