Re: How to write a simple parser?

From: Date: Mon, 27 Nov 2000 09:07:03 +0000
Subject: Re: How to write a simple parser?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-27514@lists.php.net to get a copy of this message
Im no regex expert so I wont try to give you any syntax. but I can say your looking for $html = ereg_replace("[regex stuff]", "new HTML", $command) not ereg() http://www.php.net/manual/function.ereg-replace.php Chris Lee Mediawaveonline.com In article <3A232144.5BDA1DB1@shreve.net>, rodrigo@shreve.net wrote: > I neeed to write a simple parser that will interpret simple commands and > convert them to HTML. The command tags start and end with square > brackets "[]". For example, if someone where to type > "[link:www.locatio.com | locatio]" then that would translate into "<a > href="www.locatio.com">locatio</a>". > > It is just a way for users to avoid doing any HTML at all. I tried the > regular expression functions but they only return a TRUE/FALSE value. I > would like to be able to return the first part of the string, which has > the command in it. > > Thanks in advance.

« previous php.general (#27514) next »