hello and a question
| From: | Kevin Keeler | Date: | Tue, 21 Aug 2001 23:44:10 +0000 |
| Subject: | hello and a question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-63796@lists.php.net to get a copy of this message | ||
Hi. I just joined the list and, of course, I have a question. I've
searched for quite a bit of time now, but to no avail.. mostly, I suspect,
because all the relevant search terms are to broad. But heres my problem:
I have a journal I whipped up and tweak often that uses PHP and MySQL (no
small club there. :p ). The functionality I'm trying to add right now is
to be able to enclose text in a <hide> tag (what? you didnt see that
"hide"? html and email just don't mix) and it will not be displayed in the
browser. example:
I had a good day today. <hide>I shot the milkman. </hide>Tho nothign much
happened.
then i use:
$entry_hidden =
eregi_replace("<hide>.+</hide>","<hidden>",$entry);
and this works just fine, replacing the "secret" text with a non-displayed
<hidden> tag. The problem arises when I use the tag 2 or more times:
Hey <hide>losers!</hide> I think that I <hide> do not</hide> like corn.
in this case, the above blurb gets outputted as:
hey <hidden> like corn.
So how do I make it stop pattern-matching when it reaches the first
instance of </hide>, and make it work properly for each subsequent set of
the tag?
This is prolly something pretty basic in regular expressions, but in my
limited working knowledge (and the 3 tutorials I've tried), it's not
addressed. searches in the archive, the php manual, and google have also
failed me. worthy list?
I thank you in advance and hope I can tolerate the mail volume long enough
to return the favor.
--kevin