info-gnus-english
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: nnmail-split-fancy regexps confusing


From: Maciek Pasternacki
Subject: Re: nnmail-split-fancy regexps confusing
Date: Tue, 06 Jul 2004 02:23:24 +0200
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3 (gnu/linux)

On Pungenday, Confusion 42, 3170 YOLD, Lars Tobias Borsting wrote:

> MYREGEXP is like this: "(john|lisa)\.smith@ourmail\.com".

Egrep-flavor (or Perl-flavor) regexp, to be precise.  And without the
quotes (they aren't part of regexp).

> This is supposed to be matching "john.smith@ourmail.com" and
> "lisa.smith@ourmail.com". For this to work in gnus fancy splitting it
> must be written like this in .gnus.el:
>
> nnmail-split-fancy
>   '(| (any "\\(john\\|lisa\\)\\\.smith@ourmail\\\.com" "mail.thing"))

Yes, it's Emacs-flavored regexp (more similar to grep-and-sed-flavor
than to egrep-flavor one).  Additionally it's Lisp code, so you must
quote at least backslashes and double quotes by escaping them with
backslash.

So, actually, it'll bee "\\(john\\|lisa\\)\\.smith@ourmail\\.com" (no
triple-backslashes, escaping the dot is unneeded (but harmless)).

> So basically I have to add two backslashes in front of each regexp
> special character.

No, you have to write an old-flavoured regexp (actually,
Emacs-flavored one), and than double all the backslashes and escape
all the double quote signs with backslash.

> Why is this? Isn't it more logical to be able to write the regexp the
> way it actually is, insted of making it all cluttered with these two
> backslashes?

There are more flavors of regexps.  I can recommend the O'Reilly's
book on them.  Or, if you are interested just in Emacs syntax, info
elisp has them covered (in some Linux distributions this manual is
distributed along with Emacs, in some you have to download it
separately as Emacs Lisp manual).  Man grep should also do.

Greets,
                --japh

-- 
__    Maciek Pasternacki <maciekp@japhy.fnord.org> [ http://japhy.fnord.org/ ]
`| _   |_\  / { (2)  No matter how hard you try, you can't increase
,|{-}|}| }\/                                           the speed of light. }
\/   |____/                     ( RFC 1925, Basic Truths of Networking )  -><-


reply via email to

[Prev in Thread] Current Thread [Next in Thread]