help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: another newbie question -- auto-mode-alist regexp


From: Michael Slass
Subject: Re: another newbie question -- auto-mode-alist regexp
Date: Mon, 23 Sep 2002 23:17:37 GMT
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Michael Slass <address@hidden> writes:

>In a regexp, backslash is used to escape the following character.
>Since "." is a metacharacter meaning "any character except newline",
>if you want to match an actual dot, like in ".xml", you need to escape
>the dot, as in \.
>
>The next wrinkle is that the regexps you're looking at are represented
>as string constants.  In string constants, backslashes are used to
>introduce escape sequences, or characters that are harder to type.
>'\n' represents the newline character, for example.  In order to
>introduce a literal backslash into a string constant, you need to
>escape the backslash with another one "\\"
>
>Putting that together, in a regexp string constant, "\\." will match
>exactly one literal dot.
>
>
>In emacs regexps, \' is an anchor regexp:
>
>,----
>| `\''
>|      matches the empty string, but only at the end of the buffer or
>|      string being matched against.
>`----
>
>You can read all about that in the emacs manual that came with your
>emacs.  To read this from within emacs:
>
>C-h i <RET> m emacs <RET> m regexps <RET>
>
>BOL.
>
>-- 
>Mike Slass


There's an extra <RET> in my instructions above.  This is correct:

C-h i m emacs <RET> m regexps <RET>

-- 
Mike Slass


reply via email to

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