Combining multiple regex rules for performance?

Hi,

I've been experimenting with regex rules to block a lot of domains like Facebook, ... When going over other users their regex.lists, I've noticed a lot of separate entries for the same website groups, ex:

(^|\.)facebook\.[A-Za-z0-9]+$
(^|\.)fb\.[A-Za-z0-9]+$
(^|\.)fbcdn\.[A-Za-z0-9]+$
(^|\.)fbsbx\.com$
(^|\.)fbsbx\.com\.online-metrix\.net$
(^|\.)m\.me$
(^|\.)messenger\.com$
(^|\.)tfbnw\.net$
(^|\.)instagram\.com$
(^|\.)whatsapp\.com$

Wouldn't a combined regex rule, reduce the processing time for each dns request?

(^|\.)(fb|facebook|thefacebook|fbcdn|fbsbx|tfbnw|fburl|messenger|instagram|whatsapp)\.[A-Za-z0-9]+$

Note: This rule will block a lot more dns requests as it'll match any top-level domain.

The best way to know is to try it and see what your results are.

1 Like