|
| From: | Cecil Westerhof |
| Subject: | Re: Getting the right dictionary for e-mail and newsgroup messages |
| Date: | Tue, 05 Jan 2010 21:47:34 +0100 |
| User-agent: | Gnus/5.11 (Gnus v5.11) Emacs/22.3 (gnu/linux) |
Ted Zlatanov <tzz@lifelogs.com> writes:
> 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?
> If the '.' character is not in your word class (it shouldn't be), you
> can use
>
> (string-match "\\bnl\\b" "X.nl.X")
This also matches:
(string-match "\\bnl\\b" "X-nl-X")
But I do not think that is a problem. So I now use "\\bnl\\b". That is a
lot clearer as "^nl\\.\\|\\.nl\\.\\|\\.nl$" and easier to adopt when
another language has to be added.
Thanks.
--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
| [Prev in Thread] | Current Thread | [Next in Thread] |