Re: Regex Help

From: Date: Thu, 19 Dec 2002 18:47:04 +0000
Subject: Re: Regex Help
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-128900@lists.php.net to get a copy of this message
gawd, Jim, you are soooo oicky <GRIN> <?php $q = "test, something <OPTION VALUE=\"test\">test</OPTION> test"; ereg("(.*)(<OPTION.*OPTION>)(.*)",$q,$ar); $w1 = ereg_replace("test","anotherword",$ar[1]); $w2 = ereg_replace("test","anotherword",$ar[3]); $t = $w1.$ar[2].$w2; print $t; ?> outputs: anotherword, something <OPTION VALUE="test">test</OPTION> anotherword ----- Original Message ----- From: "Jim" <user@lifeforjesus.org> To: <php-general@lists.php.net> Sent: Thursday, December 19, 2002 12:25 PM Subject: Re: [PHP] Regex Help Whoops, sorry post aborted prematurely. What I was going say say was that: test, something <OPTION VALUE="test">test</OPTION> test! should become: anotherword, something <OPTION VALUE="test">test</OPTION> anotherword! Thanks again for helping! ----- Original Message ----- From: "Jim" <user@lifeforjesus.org> To: <php-general@lists.php.net> Sent: Thursday, December 19, 2002 1:24 PM Subject: Re: [PHP] Regex Help > Thanks for helping. Unfortunately, that doesn't quite accomplish the task > either. The other example for my first post would be mangled with that. > > ----- Original Message ----- > From: "Rick Emery" <remery@emeryloftus.com> > To: "Jim" <user@lifeforjesus.org>; <php-general@lists.php.net> > Sent: Thursday, December 19, 2002 1:09 PM > Subject: Re: [PHP] Regex Help > > > > <?php > > $q = "test <OPTION VALUE=\"test\">test</OPTION> test"; > > ereg("(.*)(<OPTION.*OPTION>)(.*)",$q,$ar); > > $t = "anotherword".$ar[2]."anotherword"; > > print $t; > > ?> > > > > outputs: > > anotherword<OPTION VALUE="test">test</OPTION>anotherword > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#128900) next »