$this->post['message'] = preg_replace('!(\\[url(\\[img)?|\\[email|\\[img)(.*)((\\[\/img\\])?\\[\/url\\]|\\[\/email\\]|\\[\/img\\])|<a[^>]*(http|www|mailto)(.*)</a>|(http:\/\/)?www(.*)[\s]\b|<img[^>]*(src|border|title)(.*)(</img>|\/>)|[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}\b!siU', construct_phrase(), $this->post['message'].' '); PHP: Regular expressions are a book with seven seals to me. The above expression filters all links and replaces them with the result of the construct_phrase function. Instead of filtering for all urls ("(http:\/\/)?www(.*)") I would love to exclude my own domain from that filter. So if the link matches (www.)mydomain.com, the construct_phrase function should not be applied. How would I change the expression to achieve this?
Well, it could probably be done via a regex, but you may consider preg_repace_callback, this allows you to write your own PHP function for the rewrite. In that function you could do your own checks. Again, there probably is a better way.
If every URL including your own URL goes to construct_phrase() function then in that functin just match your domain name and return the original data.