I have the following regexp (/\?(.*?)\&/) which when I use it in the following javascript code it removes the “?” from the replacement result.
href=href.replace((/\?(.*?)\&/),"")
The beginning href value is this…
/ShoppingCart.asp?ProductCode=238HOSE&CouponCode=test
I get this as my result right now…
/ShoppingCart.aspCouponCode=test
I would like to get this…
/ShoppingCart.asp?CouponCode=test
How would I modify the Regexp to do this
Thanks for you help.
To do it properly, you’ll need a regex lookbehind, however this should work in your case: