How to relink/delink image URLs to point to the full image?

后端 未结 2 1194
广开言路
广开言路 2020-12-22 04:58

I\'m trying to change the URL\'s of a webpage on the fly using Greasemonkey.

The target page has links like:



        
2条回答
  •  粉色の甜心
    2020-12-22 05:06

    I think you want something like this,

    > var s = '\n   Gallery pic 1 of 20 pics\n ';
    undefined
    > var f = s.replace(/(href=")[^"]*([\s\S]*?)(src=")([^"]*)([\S\s]+?<\/a>)/g, '$1$4$2$3$4$5');
    undefined
    > var result = f.replace(/thumb(?=.*thumb)/, 'full');
    undefined
    > result
    '\n   Gallery pic 1 of 20 pics\n '
    

提交回复
热议问题