58

How can I search for expressions like 'foo|bar' on webpages using browsers like Google Chrome or Firefox?

1

6 Answers 6

27

For Google Chrome, you could install one of the following extensions:

  1. Regular Expression Searcher

    • To open the extension, press /.

    • To start searching, press Enter.

    • To jump to the next match, press N.

    • To jump to the previous match, press Shift + N.

  2. Regex Search

    • To open the extension, press Alt + Shift + F.

    • To start searching, press Enter.

    • To jump to the next match, click Next.

    • To jump to the previous match, click Prev.

After installing the extension, restart your browser. When testing the extension, note that extension are disabled by default on Chrome's "special" pages, such as New Tab or the Chrome Webstore.

6
  • 6
    I tried both these and neither worked.
    – Jason
    Oct 3, 2012 at 17:07
  • Regular Expression Search works better for me, Regular Expression Searcher breaking the html code (specially in <pre> text)
    – kenorb
    Mar 13, 2013 at 11:57
  • 2
    Another extension in the Chrome Web Store is Regex Search. It is more highly rated than the other two, and it works for me.
    – mernst
    Oct 25, 2014 at 16:56
  • @mernst: I've replaced my second suggestion (which is horribly broken in the latest Chrome) with yours. If you could jump to the next match without using the mouse, it would be perfect.
    – Dennis
    Oct 25, 2014 at 17:15
  • 1
    Regex Search is open source which I feel important in any extension that gets full access to all pages I browse. Can now jump by Enter/Shift+Enter. Nov 5, 2015 at 10:59
17

Another option is VIMIUM.

The point of this Chrome plugin is to get Vim navigation on your Chrome pages, so you can use keys like J and K to scroll down the page.

However, since it is Vi-based, Vimium supports regular expressions.

Much like Vim, while looking at the page, type "/<regexp>, and it will start searching the page. I don't use it often (I use Ctrl + F much more), but when I need it, it is there and works.

To work with regexp while searching you need to turn it on in the plugin advanced options.

4
  • -1: Doesn't do regex search, which is what OP asked for...
    – mgalgs
    May 14, 2013 at 20:37
  • 1
    Yeah it does by "/" and your RegExp May 15, 2013 at 22:22
  • 12
    Oh, looks you have to enable an option in the Vimium Advanced Options to turn on regex searching. Quite useful! Will upvote if you edit your answer to include mention of the fact that you have to enable it in the Vimium options.
    – mgalgs
    May 16, 2013 at 0:25
  • 2
    The option in Vimium required for this to work is: 'Treat find queries as JavaScript regular expressions' Jul 29, 2021 at 11:24
4

Firefox

I recently went looking for this very feature as I got tired of searching for a word and having to go through all the instances where the word I'm looking for is a sub-string of a larger word.

Regex Find is a nice lightweight extension which enhances the standard Firefox Find Bar by adding an option to treat the search term as a regular expression. It seems to be Open Source as it source code is available on GitHub.

I also like it because it works well with VimFx.

3

Here's a bookmarklet that'll highlight regular expression searches. It doesn't have incremental search like the native find box, but it does the job. Each new search is highlighted in a different color.

1

Fastest Search is the best text search on a page and in all tabs:

Count, regular expressions, visualize & list result/find-as-you-type.

There is an optional instant web and history search in the URL bar. It has the best custom search, multi-tab preview for selected text, dnd image/lnk, and autocopy.

1

Checkout the Fastest Search Firefox Addon.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .