...

View Full Version : preg_replace problems (again)



tylerjca
06-20-2006, 03:12 AM
I'm trying to create the equivalent of for my site.
But everything I try, only works a little bit, or not at all.
here's what I got now:


<?php
//do function
function doNoParse($tstring){
$newtext = preg_replace("|\[(.*?)\]|i","[*$1]",$tstring);
return $newtext;
}

//test string
$text = "this is a test thread!

this shouldn't parse.. at all
this would be green!
this should be seen
this would be yellow!
[whatever]

this should be blue!";

//strip out noparse tags and process tags within
$text = preg_replace("(\[noparse\](.*?)\[\/noparse\])i",doNoParse("$1"),$text);

//echo the finished product
echo $text;
?>


but it just parses the color tags within the noparse tags...



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum