[Top][All Lists]

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

Re: elisp regexp, what does this mean?

From: Alan Mackenzie
Subject: Re: elisp regexp, what does this mean?
Date: Tue, 3 Mar 2009 10:07:00 +0000 (UTC)
User-agent: tin/1.6.2-20030910 ("Pabbay") (UNIX) (FreeBSD/4.11-RELEASE (i386))

address@hidden wrote:
> I am trying to understand what the following:

> (defun erl-ie-eval-expression (node)
>  (interactive (list (erl-ie-read-nodename)))
>  (erl-ie-read-nodename)
>  (let ((end (point))
>        (beg (save-excursion
>               (loop do (re-search-backward "\\(\\`\\|^\\<\\)")
>                     while (looking-at "end"))
>               (point))))
>    (erl-ie-evaluate beg end node t)))

> Or rather the inner part involving the (scattered toothpick style)
> regexp.

OK, for a start, double backslashes are really just single ones - you
need to write them double because they're in a lisp string.  If you
write it out with this substitution, and on two lines, it looks like

    \(  \|   \)
      \`  ^\<

This regexp matches EITHER a match for \` OR a match for ^\<.
\` matches anything at the beginning of the (visible part of the) buffer.
^\< matches the beginning of a word at the start of a line.

This is all documented on the page "Syntax of Regexps" in the Elisp

> BR

Alan Mackenzie (Nuremberg, Germany).

reply via email to

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