[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: regexp that matches newline characters?
From: |
Xah |
Subject: |
Re: regexp that matches newline characters? |
Date: |
Fri, 9 May 2008 13:07:54 -0700 (PDT) |
User-agent: |
G2/1.0 |
On May 9, 9:53 am, "Dmitri Minaev" <min...@gmail.com> wrote:
> I tried to extract a tag from an xml file to parse it later, but I
> can't find a regexp that would match an xml tag with its content,
> including newlines. Dot doesn't match newlines. The elisp manual
> mentions that "complemented character alternative" matches a newline,
> so I used this funny template:\\(<author>[^±]*?</author>\\). Of
> course, this is not the right thing to do. What would be the correct
> regular expression?
Line ending char can be matched by \n, but you'll need to double the
backslash.
However, this is prob what you want:
(some-regex-func "<author>\([^<]+\)</author>" ...)
which captures the content.
See here for some explanation and frequently used patterns:
http://xahlee.org/emacs/emacs_regex.html
Xah
xah@xahlee.org
∑ http://xahlee.org/
☄