零宽度令牌? [英] zero width token?

查看:29
本文介绍了零宽度令牌?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想问一个关于令牌的非常基本的问题,
在阅读正则表达式时,书标签插入符号(^)作为零宽度标记,你能告诉我零宽度实际上是什么意思吗?

I want to ask a very basic question about token,
while reading about regex,the book tag caret(^) as a zero width token, can you please tell me what actually it means by zero width?

推荐答案

表示不消耗任何字符进行匹配.它只是一个位置断言(必须在行的开头").另一个例子是零宽度前瞻和后视断言.例如,Perl 正则表达式 /abc(?=123)/ 匹配序列 abc 仅当其后跟序列 123 时,但它实际上并不消耗 123.

It means that it matches without consuming any characters. It is simply a positional assertion ("must be at the start of the line"). Another example is zero-width look-ahead and look-behind assertions. For instance, the Perl regex /abc(?=123)/ matches the sequence abc only if it is followed by the sequence 123, but it doesn't actually consume the 123.

这篇关于零宽度令牌?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆