Long back, I wrote an article on how to open particular web searches in Incognito mode. It used RegEx which made me wonder what if you could do the same with the “Find in Page”. For instance, mostly while researching for an article I come across research papers which are usually long and vast. So, if I just want to read the relationship between graphene and lithium-ion, I need lines or paragraphs which contain both of those words. But, if you do a normal find on Google Chrome and type “Graphene lithium-ion”, it would look for an exact word and return no results.
So, if I could use regular expressions, I could refine my search to graphene or lithium-ion. Moreover, I could search for paragraphs that contain these words. Turns out, Google Chrome has a native method and you also have a couple of extensions that could help. So, here is how to advanced find search in Google Chrome.
How to Do Advanced Find Search in Google Chrome
In case you are not familiar with the Inspect element and HTML code, I would recommend you skip to this section.
1. Native Method
The normal “Find in page” option doesn’t support regular expression or search operators. However, the search option in the “Inspect Element” does support regular expressions but there’s a caveat. The inspect element find doesn’t search on the webpage but instead searches the HTML source code. Hence, the search results would point to the source code rather than the webpage. So, you would have to read out the content from the source code.
To get to that, right-click and click on “Inspect”. Alternatively, you can also press Ctrl+Shift+I (⌘+Shift+C on Mac) to get to Inspect Element.
Next, press Ctrl+Shift+F(⌘+Shift+F on Mac) to get to the advanced find bar. Alternatively, you can also click on the three buttons at the top-right corner and click on “Search”.
To enable regular expression based search, click on the “.*” button.
Now, the find search bar supports search keywords with regular expressions. For instance, I am on this Electric vehicle Wiki page. Now, this page the entire evolution of electric motors, battery technology, self-driving, etc. But, I am only interested in the relation between electric vehicles and Lithium-ion batteries. So, I want those paragraphs which contain both these words. So, on the search bar, I key in “electric vehicles .* lithium-ion”. This will give me search results where the sentence starts with electric vehicles and have the paragraph has at least 1 instance of lithium-ion.
So, now within the output, if you hover over the result it will pop-up the source code. And this is the problem I mentioned in the first paragraph. The search result won’t highlight the text on the webpage but instead, highlight the source code.
Another problem with this method is that the inspect element data also contains HTML tags and other CSS attributes. This method is extremely useful if you work a lot with the website source code. This would come really handy when you have to troubleshoot problems in the CSS code or HTML.
2. Chrome Extension
The easiest way to do an advanced search is by using Chrome Extensions. Chrome RegEx Search is an extension that lets you use a regular-expression based search on any webpage directly. All you have to do is download and install the extension and it is available on every webpage. To trigger it, just press Ctrl+Shift+F on any webpage and you will have the Chrome Regex search. The search bar supports regular expression by default and works straightaway. The extension, however, has “case sensitive” search turned on by default. You can click on the “i” button and disable it.
Download Chrome Regex Search
These are a couple of ways to enable regular-expression based search in google chrome. To help you with regular expressions, here is a website for all Regex cheat sheet.