How to Filter Extracted Links with Regular Expressions in Link Extractor

Updated

Link Extractor includes a regular expression filter that narrows any extracted link or domain list down to the entries matching a pattern you define. You can also save frequently used patterns for quick reuse and import or export your saved expressions. This applies to links pulled from a site, selected text, the clipboard, selected tabs, or PDF documents, since the filter works on the extracted result rather than the source.

How the filter works

After you extract links, the extension gives you a filter field that accepts a regular expression. Only links or domains matching that pattern remain in the results. This is a quick filter, so it is meant for narrowing a list you already have rather than for building a list from scratch.

The practical flow is:

  1. Extract links from your chosen source (site, selected text, clipboard, selected tabs, or a PDF).
  2. Enter a regular expression in the quick filter field.
  3. Review the reduced list.
  4. Act on the result: copy to clipboard, download as a text file, or open multiple links in tabs.

Choosing a pattern

The pattern is matched against the extracted links or domains, so write it around the part you want to keep or exclude. A few common starting points:

Goal Example pattern idea
Keep one domain The domain name, escaped where needed, e.g. example\.com
Keep a path section A path fragment such as /blog/
Keep a file type An extension such as \.pdf$
Keep subdomains of a site The base domain with a wildcard-style prefix

Because the filter is a regular expression rather than a plain text search, characters like . and ? have special meaning. Escape them with a backslash when you want them treated literally.

Saving and reusing expressions

Link Extractor lets you store regular expressions for quick filtering, so you do not have to retype a pattern you use often. Saved expressions can also be imported and exported, which is useful when you want to move a set of patterns between browsers or keep a backup.

A workable routine:

  1. Build and test a pattern in the quick filter until the results look right.
  2. Save it so it is available for future extractions.
  3. Export your saved expressions if you want a copy outside the extension.
  4. Import them again on another install or after a reset.

Combining the filter with output actions

Filtering is most useful right before you do something with the results. Once the list is narrowed, you can copy the text to the clipboard, download the links and domains as a text file, or open multiple links in tabs. Filtering first keeps those actions limited to the links you actually want.

Common snags

  • Too few results: the pattern is probably too strict, or a special character is being interpreted rather than matched literally. Escape it.
  • Too many results: anchor the pattern, for example with $ at the end, to avoid partial matches.
  • Pattern works on one source but not another: the filter runs on the extracted output, so check what the extraction actually produced before adjusting the expression.

For usage instructions beyond filtering, the extension points to its Documentation and FAQ pages, and bugs or feature ideas go through its issue tracker and feature request channels.