[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: LPEG: character escapes in 're' module
- From: Andrew Zhilin <andrew_zhilin@...>
- Date: Thu, 12 Jun 2008 01:21:09 -0700 (PDT)
> A problem with these escapes is that they change meaning if you use quotes
> for your patterns. Consider the next example:
>
> compile([[c:[a-z]+\\[a-z]+]])
> compile( "c:[a-z]+\\[a-z]+")
I see the problem, but:
1. Patterns already change meaning when you use quotes instead of
[[]]. There was a discussion recently about that:
"lpeg brain melt"(http://lua-users.org/lists/lua-l/2008-05/msg00879.html)
2. Only 2 chars change meaning: '\\' and '\]' inside character
class. ']' already has documented method to be expressed without
escaping (can be included in the set as the first character, after the
optional ^). As for '\\' - we can predefine %bslash, or just clarify
in documentation that someone should use '\\\\' if pattern is
delimited by single or double quotes.
Cheers,
zOOn