HELP Page for this add-on:
https://forum.palemoon.org/viewtopic.php?f=70&t=31829
****************************************************************************
I've made a new version (4.5) of this add-on where I fixed a bug in the function ("parseReg") that returns a RegEx "object" if the function argument (a "string") has valid RegEx syntax. In the old version, this function produced an error in a particular case: when the string (the function argument) started with a forward slash and there was a backslash before the last forward slash in the string (see also the code posted below - with comments).
The new function, with comments attached:
Code: Select all
function parseReg(src){
try{
// Old "match":
// var match = src.match(/^\/(.+)\/([igm]{0,3})$/); // Without "Negative LookBehind" in RegEx, an ERROR occurs (err.message = \ at end of pattern) for src=/xxxxx\/g (for example)
// New "match":
var match = src.match(/^\/(.+)(?<!\\)\/([igm]{0,3})$/); // With "Negative LookBehind" in RegEx, this Function Returns a String if Before the LAST / there is \ --> src=/xxxxx\/g returns a String, NOT a RegEx (for example)
if(match) {
return new RegExp(match[1],match[2]);
} else{
return src;
}
} catch(err){
// alert(err.message);
return src; // Just in case, so that the Add-On does not get stuck --> An unforeseen error in the RegEx (string) syntax can be seen (examined) by opening "Filters Manager"
}
}
https://www.mediafire.com/file/61kuzhz9tikcm3p/intercept_&_modify_HTTP_response_4_5.zip/file


