I am trying to create a regular expression to do the following (within a preg_replace)
$str = 'http://www.site.com&ID=1620';
$str = 'http://www.site.com';
How would I write a preg_replace to simply remove the &ID=1620 from the string (taking into account the ID could be variable string length
thanks in advance
You could use…
I’m assuming this is meant to be a normal URL, hence the
[?&;]. If that’s the case, the&should be a?.If it’s part of a larger list of GET params, you are probably better off using…