RegEx - Regular Expression
In this tutorial we are going to review the usage of RegEx, or Regular Expression, within FocusMe.
______
Regular expression when used correctly can greatly enhance the program’s ability to find and detect keywords and key phrases. Another benefit for users is the ability to condense a large number of key elements into a string, without the need to make a unique separate entry for each target website or application. The unique and powerful aspect of RegEx is its ability to target specific words or even letter boundaries in the entire URL or Title of the website.
There are numerous uses for the RegEx format, but for the purposes of this video we are going to concentrate on the use of “word boundaries.”
In our example, we find ourselves wasting long periods of time playing games on our computer while we should be working. We can use RegEx to target specific areas to eliminate our ability to access gaming sites and programs during work hours. We will create a RegEx string to limit both gaming sites in general, as well as limiting gaming platforms such as Steam and Origin currently installed on our machine.
To start, we create a new plan called Game Blocking. Click on Add Plan in the upper right corner and add the desired plan name. We can set the notification and timer options to our preferred setting, but for now we will leave the defaults. In the next screen, we will create an entry string that will block keywords to gaming sites. First click on the Add Site and then click the Custom tab in the upper left. Select Title from the dropdown in the upper right. Click on the Add Websites Here line.
What we would like to create is a string that will match our specified keywords that is not case sensitive. So start by typing an opening parentheses followed by a question mark and the letter i (Do NOT include a space between the two characters) and then close the parentheses. We are requesting FocusMe to ignore the case sensitivity (i.e. capital vs lowercase letters) in the string that will follow.
Now our next input will be the opening word tag, so type a backslash and the letter b (lowercase) followed by another opening parentheses (Do NOT close the parentheses yet). Our next inputs will be the “words” we would like to target. Each separate word will need to be separated by a pipe (or vertical bar) created by holding shift and pressing the backslash key.
_______
In our example, we want to block key terms from gaming sites. So let’s type the terms: video game, gaming, steam, origin. Be sure to insert a vertical bar between each keyword and do NOT place a vertical bar in front of the first term or after the last term against the opening and closing parentheses. Also avoid placing spaces in front or behind each term in the string. To close the command type a closing parentheses followed by a backslash and a lower case b. This string will now block every reference to each of the exact word matches within the string. Before continuing on, make sure to check the RegEx box on the line of your new entry on the Websites screen. FocusMe will NOT recognize your newly created entry unless this box is checked or enabled. Now, click the Next button.
Our final task will include blocking the two particularly popular platform gaming applications of Steam and Origin from running on our machine while the plan is enabled. Click the Add App button in the upper right corner. Again click the Custom tab in the upper left and select the Application Title option from the dropdown in the upper right. Exactly as performed in the previous Website example, within the “Enter Apps Here” line type the following: (?i)\b(steam|origin)\b -open parenthesis, question mark, lower case i, closing parentheses, backslash, lower case b, open parenthesis, the word steam, vertical bar, the word origin, close parenthesis, backslash and finally lower case b. We have now created a string that will block any application that contains either of these words from running while the plan is active. Before continuing on, make sure to check the RegEx box on the line of your new entry on the Applications screen. FocusMe will NOT recognize your newly created entry unless this box is checked or enabled. Now, click the Next button.
Next, we would proceed to complete the plan with our desired Rules, Scheduling, and Protections as outlined in other tutorial videos.
Be sure to check out the FocusMe documentation area to obtain pre-built RegEx strings to control common websites and applications that can be time wasters and distractions.
Thank you for joining us on this video and we look forward to seeing you in the next video entitled “FocusMe - Helper”.