Ryan Bowman <[EMAIL PROTECTED]> writes:

> Does emacs support the regex syntax {4} or any of it's
> variants?

Yes. See C-h i g (emacs)Regexps

However you need to put a backslash before the curly braces:

\{4]\} instead of {4}

> I'd like to match a date a la 2005-04-19,
> so I'm trying (for the year part) something like
> "[0-9]{4}", but unless I'm doing something wrong it

"[0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}"

should do the trick. Note I used double backslashes (\\) within the
string. If your regex isn't in a string literal use single backslash
(\) .

> doesn't seem to be working.  Assuming it doesn't
> support that, is there a better way to match an string
> of digits of length 4 than "[0-9][0-9][0-9][0-9]"?
[snip]

hm... "[0-9]\\{4\\}" is fewer chars but "[0-9][0-9][0-9][0-9]" is
easier to read ...
_______________________________________________
Help-gnu-emacs mailing list
Help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

Reply via email to