Regular Expression trouble

From: Date: Thu, 14 Nov 2002 18:32:23 +0000
Subject: Regular Expression trouble
Groups: php.general 
Request: Send a blank email to php-general+get-124468@lists.php.net to get a copy of this message
I'm trying create form template as I have seen recommended in many places. It seems fairly simple but I can't seem to get ereg_replace to work the way I want it. I'm starting off easy and I want to use the sample template for entering a new record or editing an existing one. If they are editing, then I obviously want to populate the form fields with values. If it's a new entry, I don't want any values. Simple enough. A form entry looks like this: <input type="text" ... value="{Name}"> <input type="text" ... value="{Title}"> So I load the template into a variable using ob_start(), etc. I assumed that to "clear" out all the value declarations I would simply do this: $content = ereg_replace("\{.*}","",$content); But it seems to be replacing everything between the first instance of { and the last instance of }, rather than each instance of {}. I've used regular expressions before and I even tested it using grep in BBEdit 6.5 and it works as I would expect. I'm using PHP 4.1.2 on Mac OSX 10.1.5. -- Brent Baisley Systems Architect Landover Associates, Inc. Search & Advisory Services for Advanced Technology Environments p: 212.759.6400/800.759.0577

« previous php.general (#124468) next »