• I'm trying to write a greasemonkey script that adds the buro9 tag to the end of every amazon page I open

    Anyone have any ideas why it doesn't work?

    var oldUrlPath  = window.location.pathname;
    
    /*--- Test that ".compact" is at end of URL, excepting any "hashes"
        or searches.
    */
    if ( ! /\buro9$/ (oldUrlPath) ) {
    
        var newURL  = window.location.protocol + "//"
                    + window.location.host
                    + oldUrlPath + "&tag=buro9"
                    + window.location.search
                    + window.location.hash
                    ;
        /*-- replace() puts the good page in the history instead of the
            bad page.
        */
        window.location.replace (newURL);
    }
    
  • I think your regex is wrong - getting rid of the backslash before the 'b' should do it. \b is a special identifier in regular expressions, meaning a workd boundary, so:
    if ( ! /buro9$/ (oldUrlPath) ) {

About