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

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

Re: regexp that matches newline characters?


From: harven
Subject: Re: regexp that matches newline characters?
Date: Fri, 9 May 2008 15:56:07 -0700 (PDT)
User-agent: G2/1.0

On May 9, 6:53 pm, "Dmitri Minaev" <address@hidden> 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?
>
> --
> With best regards,
> Dmitri Minaev
>
> Russian history blog:http://minaev.blogspot.com

"\\(.\\|\n\\)"   matches everything.
It stands for: any character but a new-line, or a new-line.
Do not double-backslash the \n.
The  regexp must be entered as a string in an elisp expression.
In a string, \n stands as newline, \t as tab, \\ as backslash.


reply via email to

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