For a URL pattern such as this one:
/detail.php?a=BYGhs5w8e9o&b=234844617545&h=9827a
I would like Google Analytics to match only the URL's with the a and b parameters in it:
/orderdetail.php?a=BYGhs5w8e9o&b=234844617545
And thus strip out:
&h=9827a
The main goal is to be able to setup a goal in Google Analytics which covers only the a and b parameters and ignores the h parameter.
Is there an easy way to accomplish this without a negative lookahead?
Standard regular expressions do not need negative lookahead for this. Just do a match and replace. Searching for:
and replacing with
\1works with the regular expressions in Notepad++ version 6.5.5. Google's regular expressions may be subtly different.The above works by surrounding the wanted text with capturing braces and leaving the unwanted part outside. The
?needs escaping as un-escaped it means the previous item (ie thep) is optional. The\wsequence mean any "word" character so\w+means a word.