Re: LPEG: character escapes in 're' module
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: LPEG: character escapes in 're' module
- From: Roberto Ierusalimschy <roberto@...>
- Date: 2008年6月11日 08:28:48 -0300
> eqcharset(compile[[ '\\' ]], m.P"\\")
> eqcharset(compile[[ '\r' ]], m.P"\r")
> eqcharset(compile[[ '073円']], m.P"I")
>
> eqcharset(compile[[ [\n-A] ]], m.R"\nA")
> eqcharset(compile[[ [\n-\A] ]], m.R"\n\A")
> eqcharset(compile[[ [\r] ]], m.P"\r")
> eqcharset(compile[[ [\n\r\t\'\"\[\]\\] ]], m.S"\n\r\t\'\"[]\\")
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]+")
-- Roberto