Re: regexps

From: Date: Wed, 17 Jan 2001 18:14:21 +0000
Subject: Re: regexps
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-35094@lists.php.net to get a copy of this message
preg_replace will implicitly allow arrays of values for the search/replace strings. Toby Butzon wrote: > > You could loop it with foreach (which I think is the same way Perl handles > the ex you gave). > > foreach ($myArr as $myStr) { > $myStr = ereg_replace($regexp, $myStr); > } > > Note quite "one statement", but if you really wanted to shorted it (and in > the opinion of most sacrafice readability), you could say: > > foreach ($myArr as $myStr) $myStr = ereg_replace(...etc...); > > --Toby > > ----- Original Message ----- > From: "Elliot L. Tobin" <elliot@UDel.Edu> > To: <php-general@lists.php.net> > Sent: Tuesday, January 16, 2001 11:59 AM > Subject: [PHP] regexps > > > Is there a way to call one regexp on multiple variables, in one > statement? > > In Perl, I'd do: > > > > s/this/that for ($var1, $var2, $var3); > > > > tia.. and please reply directly. > > > > Elliot@udel.edu > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > > For additional commands, e-mail: php-general-help@lists.php.net > > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net -- Monte Ohrt <monte@ispi.net> http://www.ispi.net/

« previous php.general (#35094) next »