I’ve tried looking into preg_replace, except that I have not much experience with regular expressions.
What I’m trying to do is replace a portion of text ending with a colon and make it bold and put a line break in before and 2 line breaks after.
IE convert this text
title1: is some text here. title2: another piece of text.
to
**title1:**
is some text here.
**title2:**
another piece of text
I’ve tried doing something like this…
preg_replace("!\*(.*?)\*!$:","\<br \/\>\<strong\>!\*(.*?)\*!\<\/strong\>\<br \/\>",$text);
I can’t seem to get it to work.
Can anyone help?
Thanks
Andi
preg_replaceregexes need to be delimited. So, first, try encasing your regex in slashes. Second, I don’t understand your regex. Something simple like/(\w+):/should work.@AndiLeeDavis Edited answer to handle multi-word titles and get rid of extraneous breaks at the beginning: