[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Unquoted special characters in regexps
From: |
martin rudalics |
Subject: |
Re: Unquoted special characters in regexps |
Date: |
Fri, 03 Mar 2006 16:51:52 +0100 |
User-agent: |
Mozilla Thunderbird 1.0 (Windows/20041206) |
> "\\(\[[0-9]+\] \\)*\\([a-zA-Z0-9.$_]+\\)\\.[a-zA-Z0-9$_<>(),]+ \
> \\(([a-zA-Z0-9.$_]+:\\|line=\\)\\([0-9.,]+\\)"
>
> Experience tells me that this should be probably written as
>
> "\\(\\[[0-9]+\\] \\)*\\([a-zA-Z0-9.$_]+\\)\\.[a-zA-Z0-9$_<>(),]+ \
> \\(([a-zA-Z0-9.$_]+:\\|line=\\)\\([0-9.,]+\\)"
>
> \[ and \] in Lisp strings are equivalent to just [ and just ]. So I
> think the current value is incorrect, and the [ needs to have \\ before it.
>
> Meanwhile, the question we're discussing here is whether to write \\
> before the ]. That is harmless, and the question is whether it makes
> things clearer or more confusing. The problem is that usually it
> makes things clearer, but occasionally people could get confused when
> \\ is last in a character alternative.
The question whether writing '\\' before the `]' is relevant for the
example cited above. Usually, when I see a `\\]' outside a character
alternative I expect it to match a right bracket in some text. And,
usually, in that text a left bracket will precede the right bracket.
Hence, if in the text above the author had used `\\]' instead of `\]' it
would have been easy to conclude - from the absence of a preceding `\\['
- that something went wrong. Vice versa, when seeing a `\\[' I usually
expect it to have a corresponding `\\]' somehwere on the right.
- Re: Unquoted special characters in regexps, (continued)
- Re: Unquoted special characters in regexps, Luc Teirlinck, 2006/03/04
- Re: Unquoted special characters in regexps, Richard Stallman, 2006/03/04
- Re: Unquoted special characters in regexps, martin rudalics, 2006/03/03
- Re: Unquoted special characters in regexps, Richard Stallman, 2006/03/04
- Re: Unquoted special characters in regexps, martin rudalics, 2006/03/04
- Re: Unquoted special characters in regexps, Richard Stallman, 2006/03/05
- Re: Unquoted special characters in regexps, Richard Stallman, 2006/03/04
- Re: Unquoted special characters in regexps,
martin rudalics <=
- Re: Unquoted special characters in regexps, Luc Teirlinck, 2006/03/03
- Re: Unquoted special characters in regexps, martin rudalics, 2006/03/04
- Re: Unquoted special characters in regexps, Luc Teirlinck, 2006/03/04
- Re: Unquoted special characters in regexps, Luc Teirlinck, 2006/03/04
- Re: Unquoted special characters in regexps, Richard Stallman, 2006/03/05
- Re: Unquoted special characters in regexps, Luc Teirlinck, 2006/03/04
- Re: Unquoted special characters in regexps, martin rudalics, 2006/03/04
- Re: Unquoted special characters in regexps, Luc Teirlinck, 2006/03/04
- Re: Unquoted special characters in regexps, martin rudalics, 2006/03/01
- Re: Unquoted special characters in regexps, Andreas Schwab, 2006/03/02