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?
I want to ask a very basic question about token, while reading about regex,the
Share
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 sequenceabconly if it is followed by the sequence123, but it doesn’t actually consume the123.