Forum Moderators: coopster
Basically, I want to convert a file with lines like this "<br>text_text:" to the following... "<br>Text Text:"
In simple terms, I need to find everything between "<br>" and ":" on all lines and replace it with a capitalised, underscore-free version of itelf.
Anybody know what preg_replace or similar I'd need to use to accomplish this?
the below will work (assuming your start string is $text
$temp=$text;
while (preg_match("/\<br\>([^:]*):/",$temp,$matches))
{
$text=str_replace($matches[1],ucwords(str_replace("_"," ",$matches[1])),$text);
$temp=substr($temp,strlen($matches[1])+5);
}