Regex help / facebook

don't see the problem

These are covered.

\.([^.]+|co\.uk)$ essentially means any single tld (e.g. .com, .net, .nl, .de, .org) or the one known tld to be used with a subdomain (.co.uk), are covered.

^(.+\.)?(facebook|fb(cdn|sbx|nw)?|tfbnw)\..+$ will match things like fb.fbi.gov
or fbsbx.entirelyunrelatedwebsite.com

Any TLD would e.g. include .co.au and .co.nz as well :wink:

This is true, however going by the current facebook "blacklists", the necessary tlds are covered.

However, if you really wanted to be sure that all of your basis are covered above with .co.something:
^(.+\.)?(facebook|fb(cdn|sbx)?|tfbnw)\.(co\.)?[^.]+$

Edit:
However, I would still say that:
^(.+\.)?(facebook|fb(cdn|sbx)?|tfbnw)\.([^.]+|co\.uk)$
is sufficient for all use cases at the moment. I don't even think the .co.uk part is entirely necessary.

Final Edit:

My recommendation for this regexp going by the blacklists available to use at this time would be:

^(.+\.)?(facebook|fb(cdn|sbx)?|tfbnw)\.[^.]+$ :exploding_head:

I plead guilty - I admitted that much in my first post :wink:

fbcdn.test.com -> NO match 51 steps

fbcdn.test.com -> NO match 55 steps

covers more, and requires less steps.

@jpgpi250 not sure why but the quote blocks there have un-escaped . where they are necessary. It might cause people problems if they are looking to copy and paste from here.

Do you see it on your screen too or is it just mine?

do you mean?

Like this ^

screenshot of what I see

Yes - Perhaps it's a discourse issue. You can see in the quote blocks before expanding it has removed the escaping of the . characters. Very odd.

See what you mean, this has always been a problem with discourse, changes quote (") characters to. I try to avoid publishing code here, because of this problem, use GitHub.

May I suggest you publish the correct regex on GitHub, something like:
https://raw.githubusercontent.com/mmotti/pihole-regex/master/facebook.list

Good idea. I need to perhaps have a bit of a reshuffle with the repository, but for now I have placed them under a social media folder.

Recomended Facebook Regexp

Please warn when you reshuffle, I use the link(s) in scripts (wget)...

Will do - That's one reason why I haven't already done so. Should have thought ahead!

It will likely stay as it is for now :slight_smile: don't panic

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.