[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Patterns: Why are anchors not character classes?
- From: "Soni L." <fakedme@...>
- Date: Thu, 16 Jul 2015 19:17:57 -0300
On 16/07/15 05:44 PM, Jonathan Goble wrote:
On Thu, Jul 16, 2015 at 4:36 PM, Rena <firstname.lastname@example.org> wrote:
On Jul 16, 2015 6:04 AM, "John Hind" <email@example.com> wrote:
New character classes are unlikely to break existing code.
Except code that builds patterns from user input and escapes it like gsub(s,
Solution: forget %^ and %$ completely and use %b (beginning) and %e
(end) instead. Neither of those letters are currently in use for
character classes, so nothing would break, and the letters would be
easy to remember.
%b is already in use, actually, but for %b() or %b or %b`'
See "Pattern Item": http://www.lua.org/manual/5.3/manual.html#6.4.1
Plus, by using letters, the standard trick of capitalizing the letter
can be used to say "anything but the beginning/end of the string". Not
sure how useful that would be, but it would be available if someone
Disclaimer: these emails are public and can be accessed from <TODO: get a non-DHCP IP and put it here>. If you do not agree with this, DO NOT REPLY.