I thought it would just be this:
$title = 'Brother! The house is on fire!';
$sometitle = preg_replace('/^the$/','',$title);
or
$title = 'Brother! The house is on fire!';
$sometitle = preg_replace("/^the$/","",$title);
But neither appear to do anything. I only want the word "the" removed when it is by itself. I tried str_replace as well, but it removed all instances of the word "the".
I'm not super experienced with regular expressions and most of what I found on google showed it like one of the two above. Any ideas?

New Topic/Question
Reply



MultiQuote






|