[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Domain names with dots
From: |
Michael Albinus |
Subject: |
Re: Domain names with dots |
Date: |
Thu, 23 Apr 2009 15:03:27 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.91 (gnu/linux) |
James Yoo <address@hidden> writes:
> wouldn't a '.' be interpreted as "anything" in the regex or is it just a
> regular dot in a character class?
See the Elisp manual (info "(elisp)Regexp Special")
`[ ... ]'
is a "character alternative", which begins with `[' and is
terminated by `]'. In the simplest case, the characters between
the two brackets are what this character alternative can match.
Thus, `[ad]' matches either one `a' or one `d', and `[ad]*'
matches any string composed of just `a's and `d's (including the
empty string), from which it follows that `c[ad]*r' matches `cr',
`car', `cdr', `caddaar', etc.
You can also include character ranges in a character alternative,
by writing the starting and ending characters with a `-' between
them. Thus, `[a-z]' matches any lower-case ASCII letter. Ranges
may be intermixed freely with individual characters, as in
`[a-z$%.]', which matches any lower case ASCII letter or `$', `%'
or period.
Note that the usual regexp special characters are not special
inside a character alternative. A completely different set of
characters is special inside character alternatives: `]', `-' and
`^'.
Best regards, Michael.