Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

preg_replace 1

Status
Not open for further replies.

jamesp0tter

Programmer
Feb 20, 2003
119
PT
well, here's my problem:
i have:

$somestring = "(b) texttt t t e x t (b)"; (notice the same string in the beginning and the end (b) )

now, i want to transforme it into something like:

$resultstring = &quot;<b> texttt t t e x t </b>&quot;; (notice de ending tag </b>, different from the first)

how to do this? :
tkx in advance
 
[tt]preg_replace(&quot;/\(b\)(.*?)\(b\)/g&quot;, &quot;<b>\$1<\/b>&quot;, $string);[/tt]
should do what you want. //Daniel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top