I have spent hours looking for a solution to this to no avail I want to turn a bunch of text like this: <a href=http://www.321energy.com/>321 Energy</a><br> <a href=http://calenergy.blogspot.com/>California Energy</a><br> <a href=http://commontragedies.wordpress.com/>Common Tragedies</a><br> <a href=http://earlywarn.blogspot.com/>Early Warning</a><br> into this: <a href=http://www.321energy.com/></a><br> <a href=http://calenergy.blogspot.com/></a><br> <a href=http://commontragedies.wordpress.com/></a><br> <a href=http://earlywarn.blogspot.com/></a><br> I want the values between the /> and </a> tags removed Seems simple but no online guide seemed to explain it
Hi, Try: $string='<a href=http://www.321energy.com/>321 Energy</a><br> <a href=http://calenergy.blogspot.com/>California Energy</a><br> <a href=http://commontragedies.wordpress.com/>Common Tragedies</a><br> <a href=http://earlywarn.blogspot.com/>Early Warning</a><br>'; echo preg_replace('#(\<a[^\>]+\>)(.*?)(\</a\>)#misux','$1$3',$string)."\n"; PHP: Regards
it's a matter of using preg_replace with regular expressions (regex) as koko described above. haven't checked their code yet, but it looks right.