[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: Sun, 26 Feb 2006 12:22:44 -0600 (CST)

Martin Rudalics wrote:

    > Apart from correcting the bug we are discussing, it also corrects
    > another misstatement:
    >     For example, a string with unbalanced square brackets is invalid
    >     (with a few exceptions, such as `[]]'),
    > That is incorrect as the examples below show.
    > ELISP> (string-match "]]]]" "]]]]")
    > 0
    > ELISP> (string-match "[[]" "[")
    > 0

   Your example doesn't show that.  You reason about validity in presence
   of a sentence like

          *Please note:* For historical compatibility, special characters
       are treated as ordinary ones if they are in contexts where their
       special meanings make no sense.

You are confusing validity with meeting stylistic guidelines.  The
fact that string-match returns 0 instead of throwing an error shows
that the regexps are valid.  "*", "." and so on are valid regexps too,
even though they violate stylistic guidelines. "[" is _not_ a valid

You can change stylistic guidelines by making doc changes.  You can
only change what is valid by making code changes.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]