We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(?:x) 匹配 'x' 但是不记住匹配项,因此也不能反向引用该匹配值,这种叫作非捕获括号
const reg1 = /(\w+),(\d+),(\w+)/ const reg2 = /(?:\w+),(?:\d+),(\w+)/ const str = 'abc,123,de' str.match(reg1) // ["abc,123,de", "abc", "123", "de"] str.replace(reg1, '$1哈哈$2哈哈$3') // $n (n是一个数字,表示第n个捕获组的内容) // "abc哈哈123哈哈de" str.match(reg2) // ["abc,123,de", "de"] str.replace(reg1, '$1哈哈$2哈哈$3') // "de哈哈$2哈哈$3"
The text was updated successfully, but these errors were encountered:
No branches or pull requests
(?:x) 匹配 'x' 但是不记住匹配项,因此也不能反向引用该匹配值,这种叫作非捕获括号
The text was updated successfully, but these errors were encountered: