note 8979 deleted from ereg_replace by jmcastagnetto

From: Date: Tue, 10 Oct 2000 23:45:16 +0000
Subject: note 8979 deleted from ereg_replace by jmcastagnetto
Groups: php.notes 
Request: Send a blank email to php-notes+get-6326@lists.php.net to get a copy of this message
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???

« previous php.notes (#6326) next »