Q: What does this regular expression do and what does the function do with it? I have come across the following regular expression in a piece of client side javascript:
([^?=&]+)(=([^&]*))?

When I run it through a regular expression tester (firefox add-on), I get the values of the query string of a url highlighted in one colour, the question mark and ampersands not highlighted at all and the rest in another colour.
I'm not sure whether it is matching one colour or the other or both, but then I use the replace option and nothing gets replaced.
That's only the beginning of my question.  The piece of code in full is this:
var linkObj = new Object();
jQuery(this).attr('href').replace(
    new RegExp( "([^?=&]+)(=([^&]*))?", "g" ),
    function( jQuery0, jQuery1, jQuery2, jQuery3 ){
        linkObj[ jQuery1 ] = jQuery3;
    }
);

What are those 4 parameters in the function (jQuery0, jQuery1, jQuery2, jQuery3)?
Any help would be appreciated.
Thank you.

A: Appears to break down the GET portion of a URL.
([^?=&]+)      # 1 or more characters, exclusive of ?, = or &
(=             # = sign
  ([^&]*)        # any character not a &, 0 or more times
)?             # but optional

The function is a callback which replace can accept with regular expression calls. Each argument is a different value found within the regex match. The function can then return the result that the replace method should substitute with). So, given ?foo=bar:


*

*jQuery0 - full match

*jQuery1 - First capture (e.g. foo)

*jQuery2 - Second capture (=bar)

*jQuery3 - Third (nested) capture (bar)

