Removing the second capture group. After the changes suggested by Jeff Roberson,...
authorunknown <Igen005@.upcorp.ad.uprr.com>
Fri, 24 Sep 2010 14:37:03 +0000 (09:37 -0500)
committerunknown <Igen005@.upcorp.ad.uprr.com>
Fri, 24 Sep 2010 14:37:03 +0000 (09:37 -0500)
http://stackoverflow.com/questions/3771105/can-someone-tell-me-the-purpose-of-the-second-capture-group-in-the-jquery-rts-reg

src/ajax.js

index 9886fd7..eebb81b 100644 (file)
@@ -7,7 +7,7 @@ var jsc = jQuery.now(),
        rbracket = /\[\]$/,
        jsre = /\=\?(&|$)/,
        rquery = /\?/,
-       rts = /([?&])_=[^&]*(&?)/,
+       rts = /([?&])_=[^&]*/,
        rurl = /^(\w+:)?\/\/([^\/?#]+)/,
        r20 = /%20/g,
        rhash = /#.*$/,
@@ -275,7 +275,7 @@ jQuery.extend({
                        var ts = jQuery.now();
 
                        // try replacing _= if it is there
-                       var ret = s.url.replace(rts, "$1_=" + ts + "$2");
+                       var ret = s.url.replace(rts, "$1_=" + ts);
 
                        // if nothing was replaced, add timestamp to the end
                        s.url = ret + ((ret === s.url) ? (rquery.test(s.url) ? "&" : "?") + "_=" + ts : "");