bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: occur "^[^#]" gets next line too


From: Johan Bockgård
Subject: Re: occur "^[^#]" gets next line too
Date: Fri, 10 Oct 2003 10:15:09 +0200
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.2 (usg-unix-v)

Dan Jacobson <address@hidden> writes:

> Andreas> Dan Jacobson <address@hidden> writes:
>>> Well gosh, occur throws in the next line for free:
>>> (occur "^[^#]" nil)
>>> 79 lines matching "^[^#]" in buffer options.
>
> Andreas> [^#] matches a newline.  If you don't want that fix your regex.
>
> There is no # mentioned in Syntax of Regular Expressions Info page
> of Emacs Info.

`[^ ... ]'
     `[^' begins a "complemented character set", which matches any
     character except the ones specified.  Thus, `[^a-z0-9A-Z]' matches
     all characters _except_ ASCII letters and digits.

     `^' is not special in a character set unless it is the first
     character.  The character following the `^' is treated as if it
     were first (in other words, `-' and `]' are not special there).

     A complemented character set can match a newline, unless newline is
     mentioned as one of the characters not to match.  This is in
     contrast to the handling of regexps in programs such as `grep'.

Note that last paragraph.

-- 
Johan Bockgård




reply via email to

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