Using Regular expressions to block webpages around the internet

Good day, fellow bees!

Mostly I am able to stay clean of any distracting content for months, but from times to times I get into a binge mode with content, that I don’t consider worthwhile.

While the binge is going on, I know that I will regret it later, I know that I am in some sort of trance without being able to rip myself out of it (am maybe going to build a solution for this in the future).

After some time (mostly one or two days), I manage to get all rational about it and develop strategies to get prevent this in the future.

I would like to add a tool to my toolbox, that allows me to block websites through pattern matching using regular expressions.

So far I have only found tools like Leechblock, that allow me to use Regex for matching something in the URL, but as Youtube is such a big part of my ever worsening internet addiction, I would like to be able to block something based on the website title.

So my latest unbelievable fruitless obsession for one or two days was this (do not read on, if you have been or are into strategy games and want to stay clear of them in the foreseeable future).

Gameplays of Hearts of Iron 4

I know! Don’t look at me that way, I know!

So finally my question:

Does anyone of you professional self conditioning self quantifiers :slight_smile: maybe know a tool that I could use to cope with the growing list of things, that I don’t want to have in my life, because I want to have them in my life?

Basically I want to have something, that blocks a web page, if the title matches for a regex that I specified. Is there a tool of that you know, that can do this?

For the last escapade for example:
Adding a regex, that matches “Hearts of Iron” to a blacklist that then blocks a web page, if the title contains matches.

If not, I may build my own, any experience with this or open source browser add-ons for blocking that I could learn from / use as a basis?

Hey Leo, the closest is Focusme. It has the capability to block websites using regex selectors. The issue is that I do not think that it has the ability to do it via title but by URL.

1 Like

Thank you for the reply @cgamer1!

Unfortunately focusme wouldn’t do the job.
Regex for the URL wouldn’t be able to match anything in the use cases I have in mind.

Thank you nevertheless for the answer!

Okay, I spoke with the support at focusme and apparently it is possible to also use Regex for title matching.

Buuuut they don’t have a Linux version yet.

They said they are working on it. Here is a email sign up for anybody how wants to stay updated on that:

https://www.getdrip.com/forms/396348031/submissions/new

1 Like

This seemed like a fairly simple thing to build a quick version of, so here is a (very basic) firefox extension you can use:

It’s very bare-bones, you configure the regex to use in the extension preferences section in about:addons. Maybe I’ll extend it at some point in order to give it a better UI.

The source code is also included (under the GPL3 licence), so if nothing else, you can use it as a basis for your own version, if you want.

3 Likes

So you just built that? Awesome, @zzq!

I will try to understand the whole thing and then improve it :slight_smile:

This is an awesome learning possibility!

Big thank you, you are a hero!

1 Like

Actually I should have built that thing on my own in the first place.

I will look into how that whole extension-building-business and try to figure things out. Your extension should be a great help, thanks again!

1 Like