[Top][All Lists]

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

Re: how to use parsing expressing grammar

From: Kevin Rodgers
Subject: Re: how to use parsing expressing grammar
Date: Wed, 17 Dec 2008 20:43:28 -0700
User-agent: Thunderbird (Macintosh/20081105)

Xah Lee wrote:
There are 2 parsing expression grammars in elisp.

    *, (2008) by
Mike Mattie.
    * (2008)
by Helmut Eller.

The second one seems simpler, and i'm trying to learn it as a regex
replacement, but don't know how to use it.

Could anyone give concrete example in the following scenario?

For example, on my website i have things like:

 <p>Related essays:</p>
 <li><a href="someFilePath1">SomeTitleString2</a> someSring1</li>
 <li><a href="someFilePath2">SomeTitleString2</a> someSring2</li>

Suppose i want to change them to:

 <p>See also:</p>
 <a href="someFilePath1">SomeTitleString1</a> someSring1<br>
 <a href="someFilePath2">SomeTitleString2</a> someSring2<br>

How do i do it?

Choose the right tool for the job:

sed -e 's|^<p>Related essays:</p>$|<p>See also:</p>|' -e '/^<ul>$/,/^<\/ul>/{s|^<\(/*\)ul>$|<\1p>|;s|^<li>||;s|</li>$|<br>|;}'

And since this is address@hidden:

C-x h
C-u M-| sed -e ...

Kevin Rodgers
Denver, Colorado, USA

reply via email to

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