<?php $old = '<a href="#next">flow to the next</a> '; $new = preg_replace('/(<a href="\#.*?">)(.*?)<\/a>/is', '$2', $old); echo $new;