3
我知道JavaScript「(x)」可以記住模式和匹配,但我有一個關於它的問題。 這裏是我的代碼:?「 3」在正則表達式中的含義是什麼?
var re = /(\w*)(abc)\1\2/;
var str = '123dabc123dabc'
console.log(re.exec(str))
var re = /(\w*)(abc)\1\3/;
var str = '123dabc123dabc'
console.log(re.exec(str)) // this must be null,because "\3" is not the right pattern,but what·s the "\3" ·s match rules in here
我想知道哪些STR \3
可以匹配...
http://www.rexegg.com/regex-capture.html幫我更好地理解這個答案。並且http://www.asciitable.com/顯示符合「文本結束」字符的八進制'3'。 – StriplingWarrior
謝謝!我實際上是在尋找確切的角色...因此,爲什麼我想用一個實際可讀的角色來舉個例子。 regex101.com也非常有趣,因爲它實時爲您提供令牌匹配,因此您可以使用它並理解行爲。 – Salketer