为什么声明匹配文本的第一个字符的位置是从0开始,而文本字符串却是从一开始,不是自相矛盾吗?
一辆想出轨的无轨电车
一辆想出轨的无轨电车 2016-12-21 17:26:12
0
2
903
var reg4=/\d(\w)(\w)\d/g;
var ts ='$1az2bbc3y4dd5ee';

 var ret=reg4.exec(ts)


一辆想出轨的无轨电车
一辆想出轨的无轨电车

reply all(2)
数据分析师

Why is it stated that the position of the first character of matching text starts from 0, while the position of the text string starts from one? Isn’t it contradictory? -PHP Chinese website Q&A-Why is it stated that the position of the first character of matching text starts from 0, but the text string starts from the beginning? Isn't it contradictory? -PHP Chinese website Q&A

Please watch and learn.

巴扎黑

位置0是在第一个字符的前面,0之前没有字符,位置1前面的就是第一个字符

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template