all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lennart Borgman <lennart.borgman.073@student.lu.se>
Cc: Emacs Devel <emacs-devel@gnu.org>
Subject: Re: How do I get a ] into a reg exp?
Date: Wed, 13 Sep 2006 23:42:33 +0200	[thread overview]
Message-ID: <45087B49.7070807@student.lu.se> (raw)
In-Reply-To: <450878C1.7020201@student.lu.se>

Lennart Borgman wrote:
> David Kastrup wrote:
>> 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.)
>>
>>   
> Thanks. That was a surprise.

New surprise. I still can not get it to work. This is my actual search:

   (re-search-forward "'\\([][-+a-zA-Z~<>!;,:.'\"%/?(){}$^0|]\\)'" nil t)


The above version does not match [  -- in the parenthesis.

  parent reply	other threads:[~2006-09-13 21:42 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
2006-09-13 21:31   ` Lennart Borgman
2006-09-13 21:35     ` Drew Adams
2006-09-13 21:42     ` Lennart Borgman [this message]
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=45087B49.7070807@student.lu.se \
    --to=lennart.borgman.073@student.lu.se \
    --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.