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

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

Re: Getting the right dictionary for e-mail and newsgroup messages


From: Ted Zlatanov
Subject: Re: Getting the right dictionary for e-mail and newsgroup messages
Date: Tue, 05 Jan 2010 13:12:07 -0600
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.1.90 (gnu/linux)

On Fri, 25 Dec 2009 11:08:27 +0100 Cecil Westerhof <Cecil@decebal.nl> wrote: 

CW> I only have one problem. At the moment I need to use:
CW>     "^nl\\.\\|\\.nl\\.\\|\\.nl$" 
CW> for the regular expression. I would prefer to use something like:
CW>     "[\\.^]nl[\\.$]"

CW> But that does not work. Is there another way to make the regular
CW> expression simpler?

The simplest solution is probably to use split-string, since you'll get
all the path components that way:

(member "nl" (split-string "X.nl.X" "\\."))

Your regex character class of [\\.^] doesn't work because it's matching
the character ^ and not the beginning of the line.  Same for the [\\.$]
class.

If the '.' character is not in your word class (it shouldn't be), you
can use

(string-match "\\bnl\\b" "X.nl.X")

which is probably the best regex-based solution, so it will work with
your existing code.  You could also use \< and \> but that's probably
unnecessary.  Look at the ELisp manual, section "Backslash Constructs in
Regular Expressions" for details.

Ted


reply via email to

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