RegExp explanation?
RegExp explanation?
I'm reading "jQuery Cookbook Solutions and Examples for jQuery Developers" and I've come across what i believe is a java script function call within the selector that they are creating in the example, but I don't understand how all the arguments (parameters) work, that are in the function in the second line (the 'RegExp' ) below.
jQuery.expr[':'].data = function(elem, index, m) {
var regex =
new RegExp(' ([\ ' "]?)((?:\\\\\\1|.)+?)\\1(, |$)', 'g'), key = regex.exec( m[0] )[2], val = regex.exec( m[0] );
if (val) { val = val[2]; }
return val ? jQuery)elem).data(key) == val : !!jQuery(elem).data(key);
};
i think i can stumble through the rest of the lines in the selector that they're creating, but i'm struggling with the second line. is there a resource that i can use to help me understand this better?