[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Regexp: match any character including newline
From: |
Eric Abrahamsen |
Subject: |
Re: Regexp: match any character including newline |
Date: |
Thu, 17 Oct 2013 10:25:13 +0800 |
User-agent: |
Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3 (gnu/linux) |
Yuri Khan <yuri.v.khan@gmail.com> writes:
> Hello All,
>
> I’m doing regexp replacements on a hard-wrapped XHTML-alike. Here’s an
> original fragment:
>
> ===
> <tr><td><pre><code>X(n, t)
> X a(n, t)</code></pre></td><td></td>
> <td><requires><p><code>T</code> shall be
> <concept>Copy­Insert­able</concept> into
> <code>X</code>.</p></requires>
> <p>post: <code>distance(begin(), end()) == n</code></p>
> <p>Constructs a sequence container with <code>n</code> copies
> of <code>t</code></p></td></tr>
> ===
Another option (though I'm not claiming you'll actually want to do this)
is to use xml.el (comes with emacs?) to parse that xml into a tree, and
then mess with the tree. Parsing the above gets me:
((tr nil (td nil (pre nil (code nil "X(n, t) X a(n, t)"))) (td nil) " "
(td nil (requires nil (p nil (code nil "T") " shall be " (concept nil
"Copy?Insert?able") " into " (code nil "X") ".")) " " (p nil "post: "
(code nil "distance(begin(), end()) == n")) " " (p nil "Constructs a
sequence container with " (code nil "n") " copies of " (code nil
"t")))))
`xml-entity-alist' would have to be tweaked.
Like I said, you probably wouldn't want this, but it's an interesting
option...
E