I need to remove anchor tags from some text, and can\'t seem to be able to do it using regex. Just the anchor tags, not their content. For instance,
Have a try with:
$str = 'paragraphgoogle -> fooIn the div'; // first, extract anchor tag preg_match("~~", $str, $match); // then strip the HTML tags echo strip_tags($match[0]),"\n";
paragraph
output:
google -> foo