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?
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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With