LCF-AT Posted May 7, 2022 Share Posted May 7, 2022 Hi guys, I'am looking for an extension what can check the executed URL / Link for matching pattern and does change it on fly. Somehow I can not use uBlock Origin for this with any custom URL / pattern and need to find any extension or Tampamonkey script. Example: https://someurl.com/path1/path2/path3/... now before the URL gets executed by mouse click etc I want to let check it and change it when pattern does match My pattern could be like this....static https://someurl.com/path1/ if match then change to https://someurl.com/ring/ What means the result change should be... https://someurl.com/ring/path2/path3/... Pretty simple thing but as always I can not find a extension or script. I found some redirctor extensions but they are not doing that I need. In this example above I just need to change some parts in the middle only and keeping everything else. I found a script here... https://greasyfork.org/en/scripts/403100-url-replacer-redirector ....but I can not find the settings json anywhere in the TM page. Just can add the user includes sites but where to write the settings like this into... { "replacePrefix": "/BIT/", "replaceSuffix": "/", "replaceTheseStrings": { "1": "BLUE", "2": "RED", "4": "WHITE", "9": "PURPLE" } } ....maybe you can help or know anything I could use (extension / scirpt etc). Thank you. greetz Link to comment Share on other sites More sharing options...
NOP Posted May 7, 2022 Share Posted May 7, 2022 (edited) I don't know of a script but FIDDLER can easily modify a request or response Edit: Request Interceptor looks like it will do what you need Edited May 8, 2022 by NOP 1 Link to comment Share on other sites More sharing options...
LCF-AT Posted May 8, 2022 Author Share Posted May 8, 2022 Hi NOP, thanks. Looks a little complicated that AddOn. Before I found this extension... https://chrome.google.com/webstore/detail/url-auto-redirector/mckfcfnegaimgcgepikhdnajpkkhdnkn ....using some RegEx but somehow it seems not to work. If I check it right then I have to do this... My URL... https://someurl.com/path1/something ---------------------------------------------------- ^https://someurl.com/path1/(.*) to https://someurl.com/TEST/$1 Now it should just use my redirection URL + the rest after path1/ to add. I'am not sure but I think this extension dosent work right. This really sucks. greetz 1 Link to comment Share on other sites More sharing options...
Accede Posted May 8, 2022 Share Posted May 8, 2022 Us the script https://greasyfork.org/en/scripts/403100-url-replacer-redirector from this place you need to install script editor extension to you browser : Spoiler Chrome: Tampermonkey or Violentmonkey Firefox: Greasemonkey, Tampermonkey, or Violentmonkey Safari: Tampermonkey or Userscripts Microsoft Edge: Tampermonkey Opera: Tampermonkey or Violentmonkey Maxthon: Violentmonkey After you install one of this extensions above go to the script page again install the script after that stay on the site and press f5 for site reload that is how you get you settings from this script 1 Link to comment Share on other sites More sharing options...
NOP Posted May 8, 2022 Share Posted May 8, 2022 9 hours ago, LCF-AT said: I'am not sure but I think this extension dosent work right. This really sucks. Here is another option for you... Redirector which is also on GitHub This has a much better help system if you get stuck on the syntax and uses wildcard or regex 1 Link to comment Share on other sites More sharing options...
LCF-AT Posted May 8, 2022 Author Share Posted May 8, 2022 @Accede I can not find the location to enter the JSON prefix. The settings page of TM is same for all scripts. @NOP Yeah, that AddOn / Extension looks much better. I tried it out and it seems to WORK! Very good. Great find NOP. In case of Brave the notification dosen't work but works in Firefox. Anyway, so long it works its pretty well. Big Bee for you NOP. 🐝 greetz 1 Link to comment Share on other sites More sharing options...
LCF-AT Posted May 8, 2022 Author Share Posted May 8, 2022 One more question about using RegEx. Somehow it works a little diffrent as normal. On in internet I can find many RegEx online tools I can test on fly but they all do not except the same pattern as in the AddOn. Online test tool https://regex101.com/ Now for AddOn you can see some examples. https://github.com/einaregilsson/Redirector ....like this... AMP redirect Example URL: https://www.google.com/amp/www.example.com/amp/document Include pattern: ^(?:https?://)www.(?:google|bing).com/amp/(.*) Redirect to: https://$1 Pattern type: Regular Expression Description: AMP is bad: https://80x24.net/post/the-problem-with-amp/ ...and now when I wanna test it with online tool I get error on // and / (slashes). Just working when changing slashes to \/ escaped. Why is this working diffrent? Is there any rule for that or have I just to use \/ escaped slashes in Online tools or can I use both etc? Not sure so maybe anyone could explain me. When I have to use just // and when I have to use \/\/ ? Thanks. greetz Link to comment Share on other sites More sharing options...
NOP Posted May 8, 2022 Share Posted May 8, 2022 (edited) All special characters in regex when programming should be escqped The forward slash in some languages is the pattern delimiter and others not so depending what language you are programming in depends whether you need to escape it or not I use an offline tool and can change the settings for different languages which do vary slightly If you use a lot of regex then consider using something similar Edited May 8, 2022 by NOP 1 Link to comment Share on other sites More sharing options...
LCF-AT Posted May 8, 2022 Author Share Posted May 8, 2022 Thanks again NOP. So I see in this extension it seems to handle both un-escaped & escaped variants. But good to know. Years ago I used RegEx for a while but I did forget everything about already. Now need to lern it new to get some basics. What is for a tool you do use? Some standalone app? greetz Link to comment Share on other sites More sharing options...
NOP Posted May 8, 2022 Share Posted May 8, 2022 Some tools especially ones that deal with URLs will parse the forward slash for you, I'm assuming that this extension does exactly that Yes it is a standalone app I use for regex because I do some web scraping using a lot of regex and I find it much easier to create custom regex with a tool like this The one i use is RegexBuddy 1 Link to comment Share on other sites More sharing options...
LCF-AT Posted May 8, 2022 Author Share Posted May 8, 2022 Ok the tool is not free. Do you know some other free tools? I just remember in past I had also one or two RegEx tools I used but I can not find them anymore or remember the name of the tools. Really pitty. Link to comment Share on other sites More sharing options...
NOP Posted May 8, 2022 Share Posted May 8, 2022 I haven't tried it but there is a FREE alternative Expresso There is a time limit on it but you can get a FREE registration code from them to fully register it 1 Link to comment Share on other sites More sharing options...
LCF-AT Posted May 9, 2022 Author Share Posted May 9, 2022 Hi again, I found this old topic... https://forum.tuts4you.com/topic/40301-looking-for-regular-expression-lib/ ...I said I was using 2 tools called ".NET Regular Expression Designer" and "The Regex Coach". This NET app seems not to work so nice like the online tool to highlight all on fly. Do you know any other tool which works and shows all like the online tool? greetz Link to comment Share on other sites More sharing options...
NOP Posted May 9, 2022 Share Posted May 9, 2022 (edited) I don't know of any other tool that does what you want I was in a similar situation when I was learning regex but then found RegexBuuddy and haven't used anything else since because it does everything I want and more Example link grab from this page... As you can see this highlights exactly what you need to see if your regex is working I did a quick search and the best FREE one seems to Expresso. I have now tried it but IMO it isn't as good and I cant see a highlight option but it does show you the results after clicking the "Run Match" button Edited May 9, 2022 by NOP 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now