Path: utzoo!utgpu!watmath!uunet!tut.cis.ohio-state.edu!mailrus!rutgers!labrea!decwrl!ucbvax!renoir.Berkeley.EDU!munson From: munson@renoir.Berkeley.EDU (Ethan V. Munson) Newsgroups: gnu.emacs Subject: Help with backslashes Message-ID: <27258@ucbvax.BERKELEY.EDU> Date: 27 Dec 88 20:21:44 GMT Sender: usenet@ucbvax.BERKELEY.EDU Reply-To: munson@renoir.Berkeley.EDU (Ethan V. Munson) Distribution: gnu Organization: University of California, Berkeley Lines: 28 I need some help with defining constants to be used later for regular expression searches. Suppose I want to search for strings beginning with an @ sign followed by optional whitespace and then string of alpha characters. I would expect to use something like: (defconst re1 "@\\s *\\([a-z]*\\)\\1") Note that I am using parentheses to pull out substrings. Given this Lisp sexp, GNU Emacs version 18.51.9 gives the symbol re1 the value: "@\\s *\\([a-z]*\\)\\1" I didn't expect this. I thought Lisp reader would strip out one backslash from each pair. So, when I change the definition to (defconst re1 "@\s *\([a-z]*\)\1") the result is "@s *([a-z])1" Neither of these results is a regular expression that does what I want. I have to admit that I am clueless about how to solve this in a straightforward manner. Does anyone see what I am doing wrong? Ethan Munson munson@renoir.Berkeley.EDU ...ucbvax!renoir!munson