$string =preg_replace('#]+>[^<]+#i', '', $string); If you want it to be case insensitive $string =preg_replace('#]+>[^<]+#i', '', $string); If the HREF attribute should be in quotes: $string =preg_replace('#