[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Inconsistency with the manual
- From: "Soni L." <fakedme@...>
- Date: Tue, 10 Oct 2017 18:43:16 -0300
The manual states:
%f[set], a frontier pattern; such item matches an empty string at any
position such that the next character belongs to set and the previous
character does not belong to set. The set set is interpreted as
previously described. The beginning and the end of the subject are
handled as if they were the character '\0'.
A pattern is a sequence of pattern items. A caret '^' at the beginning
of a pattern anchors the match at the beginning of the subject string.
However, I noticed something kinda weird:
string.match("''", "%f[']'", 2) --> nil
string.match("''", "^'", 2) --> '
You'd think the first ' in the first string.match would be handled as
the character '\0', consistent with '^'. Or, you'd think the latter
would never match.
So uh, '^' -> runs the match only once, at the specified position?
Disclaimer: these emails may be made public at any given time, with or without reason. If you don't agree with this, DO NOT REPLY.