How to use RegEx (Regular Expressions) with FocusMe

FocusMe supports using Regular Expressions for advanced matching in your blacklist or whitelist.

If you want to learn more about Regular Expressions, you can read more here:

https://en.wikipedia.org/wiki/Regular_expression

http://perldoc.perl.org/perlre.html

http://perldoc.perl.org/perlretut.html

All RegEx entries should be added using the custom tab when you add targets, be sure to tick the RegEx checkbox after adding it.

RegEx Examples

Please visit https://regex101.com/ to test out these examples and see what they mean.

Match any Google domain

^.*google.*$

Match Google Image searches

tbm=isch

Match example.com but not anotherexample.com

\/example\.com.*

 

Match Google Searches for a particular phrase

^.*google.*q=unicorns.*$

Match google.com but not accounts.google.com or mail.google.com

Supposing you wanted to block all internet but allow only google searches (not allow gmail), then you could put this rule in your whitelist to match google.com but not accounts.google.com or mail.google.com

^(?!.*(accounts\.google\.com|mail\.google\.com)).*google\.com

Match 3 words any order, case insensitive

The example words are community, videos & vimeo

^(?i)(?=.*\bcommunity\b)(?=.*\bvideos\b)(?=.*\bvimeo\b).*$

Match any word

(?i)\b(some|rude|words)\b

Using \b and \b will block the whole keywords but not if they form part of another word.

Including (?i) makes the whole expression case insensitive.

Please visit https://regex101.com/ to test out these examples and see what they mean.

0