应该怎么写?

Tell us what’s happening:

Your code so far


let repeatNum = "42 42 42";
let reRegex = /^(\d+)(\s(\d+))$/; // 修改这一行
let result = reRegex.test(repeatNum);
console.log(repeatNum.match(reRegex))

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36.

Challenge: 使用捕获组重用模式

Link to the challenge:

let repeatNum = "42 42 42";
let reRegex = /^(\d+)\s\1\s\1$/;
let result = reRegex.test(repeatNum);
2 个赞

谢谢