Regular expression for searching “near” text (i.e., within X words)

The Chrome function for finding text on a webpage (Ctrl-F) is fine, but it doesn’t allow finding one word “near” another one. For example, if the text on the page has many instances of “this” and many instances of “that,” using Ctrl-F to find a spot where it says “this and also that” is tedious.

The Chrome plug-in “Regex Search” allows regular expressions for searching the text on a webpage. Regular expressions are powerful, but they can be a pain to create.

This Excel file creates a regular expression that allows for searching the text on a webpage to find “term_1” and “term_2” within X words of one another. The order of mention doesn’t matter, and the pair of words will still be found even if they are immediately next to each other. Such a search can be used to skip over all the solo instances of “this” and all the solo instances of “that” to find “this and also that.”

 
– Eric DeRosia