From what you have above, you appear to have an extra quote at the start of $myurl.
Also, 2 points:
1) . (dot) has meaning in a regular expression, so backslash it.
2) $domain is a variable whose contents may have meaning, so it needs to be protected.
Try something like this:
PHP Code:
$site2 = preg_replace("/http:\/\/www[1-9]\.url\.com\/".preg_quote($domain,'/')."/i", $myurl, $site);
Now, there are other ways of solving this problem which may be calculationally more efficient (such as extracting the part after the url.com/ and before the next /) and comparing against various cases. Now, you haven't really told me what you're trying to do, so this is all inferred from the code you provided.
__________________
Jeremy Miller
Please login or register to view this content. Registration is FREE
|