preg_match ID in URL
Hi I am trying to match a product ID in a url.The Problem I have is it works if the url has extra info after the ID var but not if it doesnt. Below is 2 links, the first when passed to the exp only feeds the value 2 to detailsLink instead of 21 as expected but the second link how ever works as expected. I want to disregard the url completely as detailsLink() recreates the link with the product rating/cat etc. It should also work on http or https links.
In the exp the value of $ADDRESS is 192.168.2.22/dev

Link1: http://192.168.2.22/dev/details.php?id=21
Link2: http://192.168.2.22/dev/details.php?id=21&module=info#Desc

$s = preg_replace("%(?<![=\]\'\"\w])https?://[^<>\s\'\",]*$ADDRESS\/details\.php\?id=([0-9]+)[^<>\s\'\",]+%ie", "detailsLink(\\1)", $s);

preg_match ID in URL
===

Hi I am trying to match a product ID in a url.The Problem I have is it works if the url has extra info after the ID var but not if it doesnt. Below is 2 links, the first when passed to the exp only feeds the value 2 to detailsLink instead of 21 as expected but the second link how ever works as expected. I want to disregard the url completely as detailsLink() recreates the link with the product rating/cat etc. It should also work on http or https links.
In the exp the value of $ADDRESS is 192.168.2.22/dev

Link1: http://192.168.2.22/dev/details.php?id=21
Link2: http://192.168.2.22/dev/details.php?id=21&module=info#Desc

$s = preg_replace("%(?<![=\]\'\"\w])https?://[^<>\s\'\",]*$ADDRESS\/details\.php\?id=([0-9]+)[^<>\s\'\",]+%ie", "detailsLink(\\1)", $s);
