Hi,
I'm writing a script which will convert plain text such as TITLE: into a tag such as H1 which can then be styled in CSS.
i.e.
<h1>TITLE</h1>
$mystring = "Nothing unusual ABOUT: our produce ORAS:";
echo ereg_replace("[A-Z]+:", "<h1>\\0</h1>", $mystring);
The above works but I now want to remove the colon at the end. Using substr() within the ereg_replace doesn't seem to work as it treats \0 as the literal string "\0" - not as the desired TITLE: text.
Could anyone give me some pointers on how I could get this to work? There may be multiple instances of TITLE: in a string, and all need to be replaced the same way.
Many thanks in advance for any help! 😃
Tom