How to use RegEx (Regular Expressions) with FocusMe
FocusMe supports using Regular Expressions for advanced matching in your blocklist or allowlist.
What is RegEx?
RegEx (or regexp) is short for Regular Expressions (or sometimes known as Rational Expressions). It is a special sequence of characters used to define a search pattern. FocusMe can use RegEx to match specific keywords and/or set of characters to fine-tune your blocklist/allowlist.
If you want to learn more about Regular Expressions, you can read more here:
All RegEx entries should be added using the custom tab when you add targets. Be sure to tick the RegEx checkbox after adding it.
You can visit https://regex101.com/ to test out these examples and see what they mean.
Match any Google domain
Match Google Image searches
Note: The above example actually works even if the RegEx box is unticked. Just make sure the type is set to “URL”:
Match example.com but not anotherexample.com
Match icloud.com but not other sites such as icloud.com.com/mail/
Match Google Searches for a particular phrase
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 allowlist to match google.com but not accounts.google.com or mail.google.com
Match 3 words any order, case insensitive
The example words are community, videos & vimeo
Match Any Locally Opened Files
This rule when used with URL will match any locally opened file e.g. C:\Documents\example.html
Match any word
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. You can also read about what the special characters do:
Need more help with Regular Expressions? There are tons of articles and videos about it online.