I'm trying to parse an existing html file using php.
I need to use regex to find the first (and only the first) occurance of <i>
and the last (and only the last) occurance of </i> in a string. 
They will be replaced with ||.

example of a string:
blah blah <i>some stuff</i> that i <i>need to get</i> blah blah blah.

needs to become:
blah blah ||some stuff that i need to get|| blah blah blah.

so the following is what i need.....
//replace outer tags with ||
$string = ereg_replace ("Some regex that only finds the first <i>","||",$string);
$string = ereg_replace ("Some regex that only finds the last </i>","||",$string);
//take out remaining (inner) tags.
$string = ereg_replace ("<i>","",$string);
$string = ereg_replace ("</i>","",$string);



PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to