I'm using the following code to filter out urls from a block of HTML text in PHP.
preg_replace('#<a(?![^>]+?href="?http://keepthisdomain.com/foo/bar"?).*?>(.*?)</a>#i', '1', $text);
It's intended to replace all url's that do not match the specified url pattern. However I do want to include all tags that have the attribute rel="shadowbox[a]" set.
How can I modify this preg_replace to do that?
See Question&Answers more detail:os