all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* occur "^[^#]" gets next line too
@ 2003-10-08 20:49 Dan Jacobson
  2003-10-09  9:50 ` Andreas Schwab
  0 siblings, 1 reply; 5+ messages in thread
From: Dan Jacobson @ 2003-10-08 20:49 UTC (permalink / raw)


Well gosh, occur throws in the next line for free:
(occur "^[^#]" nil)
79 lines matching "^[^#]" in buffer options.
      9:
       :# Specify which DNS Servers the incoming Win95
     14:
       :# Specify which WINS Servers the incoming conn
$ nl -b a options
     7  # To quickly see what options are active in th
     8  #   egrep -v '#|^ *$' /etc/ppp/options
     9
    10  # Specify which DNS Servers the incoming Win95

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: occur "^[^#]" gets next line too
  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>
  0 siblings, 2 replies; 5+ messages in thread
From: Andreas Schwab @ 2003-10-09  9:50 UTC (permalink / raw)
  Cc: bug-gnu-emacs

Dan Jacobson <jidanni@jidanni.org> writes:

> Well gosh, occur throws in the next line for free:
> (occur "^[^#]" nil)
> 79 lines matching "^[^#]" in buffer options.

[^#] matches a newline.  If you don't want that fix your regex.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: occur "^[^#]" gets next line too
  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>
  1 sibling, 0 replies; 5+ messages in thread
From: Dan Jacobson @ 2003-10-09 22:58 UTC (permalink / raw)


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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: occur "^[^#]" gets next line too
       [not found]   ` <mailman.1464.1065762573.21628.bug-gnu-emacs@gnu.org>
@ 2003-10-10  8:15     ` Johan Bockgård
  2003-10-10 16:04     ` Barry Margolin
  1 sibling, 0 replies; 5+ messages in thread
From: Johan Bockgård @ 2003-10-10  8:15 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: occur "^[^#]" gets next line too
       [not found]   ` <mailman.1464.1065762573.21628.bug-gnu-emacs@gnu.org>
  2003-10-10  8:15     ` Johan Bockgård
@ 2003-10-10 16:04     ` Barry Margolin
  1 sibling, 0 replies; 5+ messages in thread
From: Barry Margolin @ 2003-10-10 16:04 UTC (permalink / raw)


In article <mailman.1464.1065762573.21628.bug-gnu-emacs@gnu.org>,
Dan Jacobson  <jidanni@jidanni.org> wrote:
>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.

[^#] matches any character that isn't '#'.  Newline isn't '#', so it
matches it.

If you want to match any character that isn't '#' or newline, use "[^#\n]"
in Lisp code, or [^#C-qC-j] when entering a regexp interactively.

-- 
Barry Margolin, barry.margolin@level3.com
Level(3), Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-10-10 16:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2003-10-10 16:04     ` Barry Margolin

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.