[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Patterns: Why are anchors not character classes?
- From: "Soni L." <fakedme@...>
- Date: Sat, 18 Jul 2015 20:21:50 -0300
On 18/07/15 08:17 PM, Soni L. wrote:
Actually scratch that last part, it should be x<mod>?, because "?" would
first try to match with 1-or-more, then if it fails it would match 0.
With x?<mod> it attempts "?" indefinitely. (try match ?, it matches, try
it again, it matches, even tho they're empty matches it still matches)
On 18/07/15 07:43 PM, Rena wrote:
On Sat, Jul 18, 2015 at 3:26 PM, Tom N Harris
On Saturday, July 18, 2015 02:45:18 PM Rena wrote:
Well, regardless of whether it's classified as a character class or
or a special case or a fruit or a vegetable, I've many times wished
write a pattern such as "[ ^]%w+[ $]" (match one or more word
bounded by either a space or the start/end of a string). Though ^
No regex-like implementation I know of works like that, though. I'd
)%w+($| )". Lua doesn't have the alternation operator however. Is
really being asked for? But disguised as a discussion about
has a meaning there...
Alternation would be great, but I think it's been discussed before and
it would add too much complexity to the implementation.
Why not add the whole patterns to... everything?
[(abc)(def)] would match either "abc" or "def"; [(aaa)-(fff)] would
convert a 3 letter sequence to a number and compare it against the
number form of aaa and fff (it gives you more than just a-f 3 times,
you can also match "a¬" (UTF-8; challenge for you: figure out why));
Guess what [a-%%] would do? It would match anything from 'a' to the
'%' sign! (which you can't currently do, because %% is a character
Way more powerful than Lua patterns and not that hard to write if you
have access to tail calls. I'd take it over Lua patterns anytime, even
if it is clunkier. We also wouldn't need "0-or-more" modifiers as you
would be able to just x?<mod>!
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.