作者:海峡整形美容医院少校 | 来源:互联网 | 2023-05-18 09:04
I don't understand why the regex (?<=i:(?>\D*))\d
does not match the string i:>1
.
我不明白为什么regex (?<= I:(?>\D*) \D与字符串I:>1不匹配。
The way I undertand it:
我理解的方式是:
- at index 0: the lookbehind
i
won't match
- 在索引0处:后视镜我不匹配
- at index 1: the lookbehind
i:
won't match
- 在索引1:lookbehind i:不会匹配
- at index 2: the lookbehind
i:(?>\D*)
will match i:
but the \d
after the lookbehind won't match >
- 索引2:lookbehind i:(?>\D*)将匹配i:但lookbehind后面的\D不会匹配>
- at index 3: the lookbehind
i:(?>\D*)
will match i:>
and the \d
after the lookbehind will match 1
-> the regex is satisfied
- 在索引3:后面的i:(?>\D*)将匹配i:>和\D后面的后面将匹配1 ->,regex满足。
1 个解决方案