[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: PatternMatching symbol for magic characters :-)
- From: Roberto Ierusalimschy <roberto@...>
- Date: Mon, 15 Jun 2015 21:37:19 -0300
> This wouldn't quite be the same thing though, would it? I'm not seeing a
> very specific definition of "punctuation" in PIL or the manual, but maybe
> I'm missing it. Implementation detail? But at the very least, '%p' would
> almost certainly match commas, and '%W' would include control characters,
> white space, and other random things, right? Neither of those are quite a
> replacement for the proposed '%m' semantics.
Why would someone need '%m'? The motivation presented here was to
escape the magic characters. But Lua ensures that it is safe to escape
any non-alphanumeric character, not only the magic ones. So, you can
escape anything that matches '%p' to have a valid, non-escaped pattern:
p = string.gsub(p, "%p", "%%%0")
No need for '%m'.
-- Roberto