From: bojohan+news@dd.chalmers.se (Johan Bockgård)
Subject: Re: occur "^[^#]" gets next line too
Date: Fri, 10 Oct 2003 10:15:09 +0200 [thread overview]
Message-ID: <yoijbrsp33w2.fsf@helm.dd.chalmers.se> (raw)
In-Reply-To: mailman.1464.1065762573.21628.bug-gnu-emacs@gnu.org
Dan Jacobson <jidanni@jidanni.org> writes:
> Andreas> Dan Jacobson <jidanni@jidanni.org> 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
next prev parent reply other threads:[~2003-10-10 8:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-10-08 20:49 occur "^[^#]" gets next line too Dan Jacobson
2003-10-09 9:50 ` Andreas Schwab
2003-10-09 22:58 ` Dan Jacobson
[not found] ` <mailman.1464.1065762573.21628.bug-gnu-emacs@gnu.org>
2003-10-10 8:15 ` Johan Bockgård [this message]
2003-10-10 16:04 ` Barry Margolin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=yoijbrsp33w2.fsf@helm.dd.chalmers.se \
--to=bojohan+news@dd.chalmers.se \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.