I couldn't get it to work, maybe because I'm not very knowledgeable about regex stuff. I tried breaking it down but couldn't figure it out. This works though... see any problems?Kieran Huggins wrote:PCRE is faster than the ereg functions, and you can be a whole lot safer!Code: Select all
$domain = preg_replace('#^(?:https?://)?(?:www\.)?(.*?)(?:/.*)?$','$1',$referer);
Code: Select all
preg_replace("/^(https?:\/\/www.)?([^\/\?]+)([\/|\?])?(.+)?$/", "\$2\n", $referer);