Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
哪些 Perl 变量用于最后一次成功的正则表达式匹配的开始和结束位置?
正如手册页所perlvar解释的:
perlvar
$+[0]是整个 [最后一次成功] 匹配结束的字符串中的偏移量。这与pos函数在匹配的变量上调用时返回的值相同。 $-[0]是最后一次成功匹配开始的偏移量。
$+[0]是整个 [最后一次成功] 匹配结束的字符串中的偏移量。这与pos函数在匹配的变量上调用时返回的值相同。
$+[0]
pos
$-[0]是最后一次成功匹配开始的偏移量。
$-[0]