Possible Duplicate:
Get query string values in JavaScript
I "had" this pattern but it didn't quite give me what I need, though it worked.
var regex = new RegExp('\\b' + data.keyword + '(=[^&]*)?(&|$)',"gi");
But the following regular expressions "is" what I need but i can't seem to get it to work within the regex obj: /&dyanmicTxtHere(\=[^&])?(?=&|$)|^dyanmicTxtHere(\=[^&])?(&|$)/
I tried: This is NOT working -
var regex = new RegExp('&' + data.keyword + '(=[^&]*)?|^' + data.keyword + '(=[^&]*)?&?',"gi");
I can't figure out why. So the above regex should strip out my passed param (and vlaue)(data.keyword), and deal with the ? and & wherever that param sits in the url. It
So, what would this match?
www.someurl.com?Keyword=foo
www.someurl.com?up=down&Keyword=foo
www.somurl.com?up=down&keyword=foo&left=right
etc... so, if I passed in "Keyword" as my dynamic param, then it would remove it and its associated value.