Re: eregi_replace()

From: Date: Fri, 09 Jul 2004 22:34:30 +0000
Subject: Re: eregi_replace()
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-190113@lists.php.net to get a copy of this message
> $searchenquiry = "Never cry Wolfe" > and > $mydata->ST contains "... Never Cry Wolfe ..." > > This code echos: > <td>".preg_replace ('/('.$searchenquiry.')/i' , > "<b>$1</b>", $mydata->ST)."&nbsp;</td> > > <td>... <b>Never cry Wolfe</b> ...</td> > > But I want it to use the original text and echo: > > <td>... <b>Never Cry Wolfe</b> ...</td> I just tried this code: $searchenquiry = "Never cry Wolfe"; $mydata = "... Never Cry Wolfe ..."; $new = preg_replace ('/('.$searchenquiry.')/i' , "<b>$1</b>", $mydata); echo "<td>$new&nbsp;</td>"; here was my output: <td>... <b>Never Cry Wolfe</b> ...&nbsp;</td> isnt that what you want?

« previous php.general (#190113) next »