all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: David Kastrup <dak@gnu.org>
Cc: Emacs Devel <emacs-devel@gnu.org>
Subject: Re: How do I get a ] into a reg exp?
Date: Wed, 13 Sep 2006 22:21:17 +0200	[thread overview]
Message-ID: <85wt87frgi.fsf@lola.goethe.zz> (raw)
In-Reply-To: <45085FF6.5080403@student.lu.se> (Lennart Borgman's message of "Wed\, 13 Sep 2006 21\:45\:58 +0200")

Lennart Borgman <lennart.borgman.073@student.lu.se> writes:

> How do I write
>
>    (re-search-forward "[a-z\]]")
>
> I mean how do I get the ] into the characters to search for? It works
> if I remove a-z. Looks like a bug to me.

\] is the same as ] in string syntax.  Anyway:

(info "(emacs) Regexps")

     To include a `]' in a character set, you must make it the first
     character.  For example, `[]a]' matches `]' or `a'.  To include a
     `-', write `-' as the first or last character of the set, or put
     it after a range.  Thus, `[]-]' matches both `]' and `-'.

     To include `^' in a set, put it anywhere but at the beginning of
     the set.  (At the beginning, it complements the set--see below.)


-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

  parent reply	other threads:[~2006-09-13 20:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-13 19:45 How do I get a ] into a reg exp? Lennart Borgman
2006-09-13 20:16 ` David Hansen
2006-09-13 20:26   ` David Kastrup
2006-09-13 20:21 ` David Kastrup [this message]
2006-09-13 21:31   ` Lennart Borgman
2006-09-13 21:35     ` Drew Adams
2006-09-13 21:42     ` Lennart Borgman
2006-09-13 21:48       ` Lennart Borgman
2006-09-13 22:07         ` David Kastrup
2006-09-13 22:10           ` Drew Adams

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=85wt87frgi.fsf@lola.goethe.zz \
    --to=dak@gnu.org \
    --cc=emacs-devel@gnu.org \
    /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.