[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Unquoted special characters in regexps
From: |
Luc Teirlinck |
Subject: |
Re: Unquoted special characters in regexps |
Date: |
Sat, 25 Feb 2006 16:13:11 -0600 (CST) |
Martin Rudalics wrote:
`]' is _also_ special in a character alternative, like `^'. `-' is
special _only_ in a character alternative.
I may be overlooking something, but _which_ special meaning does `]'
have outside of character alternatives?
You are using \\] to quote `]'. Could that possibly clear up any
confusion or does it just add confusion? I personally believe the
latter. Is there a situation where \\ can be used to prevent `]' from
having a special meaning? In "[a\\]b]", the first `]' still has a
special meaning, even though there might be some optical illusion
making it look "quoted", the second `]' has no special meaning.
The only way I know of to put a "quoted" `]' in a character
alternative is to write it immediately after the `[' or "[^".
But "quoting" `]' by writing "[]]" instead of just `]', seems
contorted, even though it would be less confusing than "\\]".
I believe that a `]' should not be quoted at all if it is outside a
character alternative, where it has no special meaning, unless I am
overlooking something. (Just tell what, in that case.)
ELISP> (string-match "[a\\]b]" "]")
nil
ELISP> (string-match "[a\\]b]" "\\b")
nil
ELISP> (string-match "[a\\]b]" "\\b]")
0
Message not available
Message not available
- Message not available
- Message not available
- Message not available
- Message not available
- Re: Unquoted special characters in regexps, Richard Stallman, 2006/03/04
- Re: Unquoted special characters in regexps, Luc Teirlinck, 2006/03/01
- Re: Unquoted special characters in regexps, Richard Stallman, 2006/03/02
- Re: Unquoted special characters in regexps, Luc Teirlinck, 2006/03/02
- Re: Unquoted special characters in regexps, Richard Stallman, 2006/03/02
Re: Unquoted special characters in regexps, martin rudalics, 2006/03/02
Re: Unquoted special characters in regexps, Luc Teirlinck, 2006/03/02