[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: help with Regexps
From: |
Anselm Helbig |
Subject: |
Re: help with Regexps |
Date: |
Mon, 11 May 2009 10:33:32 +0200 |
User-agent: |
SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (Shijō) APEL/10.7 Emacs/22.3 (i686-pc-linux-gnu) MULE/5.0 (SAKAKI) |
Hi!
> I have a file that has these three types of entries (they all appear in
> the beginning of the line).
>
> 1. %\card{\word{Mutter}}{mom, mommy, mother, nut}
> 2. \card{\atl{die} \word{Erkenntnis}}{cognition, cognizance, perception}
> 3. \card{\word{Jünglinge}}{teens, younglings}
>
> And I want to be able to use (search-forward-regexp ???) within a
> function to find only 3. (and not 1. and 2).
>
> When I try: (search-forward-regexp "^\\card{\\word{[A-Z]"), emacs
> complains: Search failed: "^\\card{\\word{[A-Z]" (in fact, even
> (search-forward-regexp "^\\card") fails to find anything). What am I
> making wrong?
You have to quote the backslashes twice, the first time for the lisp
string and then for the regex:
(search-forward-regexp "^\\\\card{\\\\word{[A-Z]")
Ugly, but consistent.
HTH,
Anselm
--
Anselm Helbig
mailto:anselm.helbig+news2009@googlemail.com
- help with Regexps, Santiago Mejia, 2009/05/11
- Re: help with Regexps,
Anselm Helbig <=