I promise you I am not lying. There is one strange line in this userscript. Its
if(rePrv.test(h)||rePrv.test(h))
Now if i only have if(rePrv.test(h))
I sometimes get a false (incorrectly). However with the || i get the correct results. Its blowing my brain. What is going on? Can someone explain? It happens in under firefox 8, 11(portable) and chrome 17.0.
This is my userscript code.
// ==UserScript==
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js
// ==/UserScript==
var re=/\/?docs\/\d+/gi;
var rePrv=/\/?docs\/\d+\/private/gi;
var prvls="";
var publs="";
$('a').each(function(i, e){
var h = $(this).attr('href');
if(h==undefined)
return;
if(re.test(h)){
if(rePrv.test(h)||rePrv.test(h)){
prvls+="http://www.domain.com/"+h+"<br/>\n";
}
else {
publs+="http://www.domain.com/"+h+"<br/>\n";
}
}
});