Re: note 8979 added to ereg_replace
| From: | J. M. Castagnetto | Date: | Tue, 10 Oct 2000 23:50:16 +0000 |
| Subject: | Re: note 8979 added to ereg_replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-6327@lists.php.net to get a copy of this message | ||
XSLT should be the bset solution. Otherwise, parse you
XML file into a tree (using, for example,
xml_parse_into_struct, or the dom_* functions), and
then do the replacements and reconstruct back the
document. Cumbersome but sort of generating a XSLT
class in PHP, or adding an extension to do XSLT to the
language, that should work.
Your request for help has been removed from the Notes,
you should use the resources in
www.php.net/support.php for requesting support.
Cheers
--- master@thehaus.net wrote:
> Okay-here's a puzzle-I want to be able to do "custom
> tag replacement", which would take text like the
> following:
>
> <cmt The Master>This is a comment</cmt>
>
> and return
>
> <i>The Master comments: This is a comment</i>
>
> I thought this would do it:
>
> ereg_replace("(<cmt (.*)>(.*)</cmt>)","<i>\\2
> comments: \\3</i>",$string)
>
> but it doesn't. It also COMPLETELY fails on text
> that contains <b>...</b> within the \\3 section, ie:
>
> <cmt The Master>This is <b>a</b> comment</cmt>
>
> This blows up with the following results:
>
> <i>The Master>This is <b>a</b comments: comment</i>
>
> I'd really prefer this format for the tags anyway
> but couldn't figure it out (I suck at regexes, yeah
> yeah :-)
>
> <cmt "The Master">some text</cmt>
>
> Any ideas/help/enlightenment???
>
> http://www.php.net/manual/function.ereg-replace.php
>
>
>
> --
> PHP Notes Mailing List (http://www.php.net/)
> To unsubscribe, e-mail:
> php-notes-unsubscribe@lists.php.net
> For additional commands, e-mail:
> php-notes-help@lists.php.net
> To contact the list administrators, e-mail:
> php-list-admin@lists.php.net
>
=====
--- Jesus M. Castagnetto (jcastagnetto@yahoo.com)
__________________________________________________
Do You Yahoo!?
Get Yahoo! Mail - Free email you can access from anywhere!
http://mail.yahoo.com/