I want to take a variable called $encoded_str and and remove cd1, CD1 and anything between the first 'l' and the last blank space. So for example "lp6 id4 STRINGcd1" would return "STRING".
I'm using PHP 4 for now so I can't use str_ireplace, I have this:
$encoded_str=str_replace('CD1','',$encoded_str);
$encoded_str=str_replace('cd1','',$encoded_str);
$encoded_str=preg_replace('X','',$encoded_str);
I've RTFM for preg_replace but am a bit confused. What should I replace the X with and can you suggest a decent introductory primer for writing regular expressions?