Class RegexLinkExtractor

java.lang.Object
com.norconex.crawler.web.doc.operations.link.impl.RegexLinkExtractor
All Implemented Interfaces:
Configurable<RegexLinkExtractorConfig>, LinkExtractor

public class RegexLinkExtractor extends Object implements LinkExtractor, Configurable<RegexLinkExtractorConfig>

Link extractor using regular expressions to extract links found in text documents. Relative links are resolved to the document URL. For HTML documents, it is best advised to use the HtmlLinkExtractor or DomLinkExtractor, which addresses many cases specific to HTML.

Applicable documents

By default, this extractor will extract URLs only in documents having their content type matching this regular expression:

 text/.*
 

You can specify your own restrictions using RegexLinkExtractorConfig.getRestrictions(), but make sure they represent text files.

Referrer data

The following referrer information is stored as metadata in each document represented by the extracted URLs:

Character encoding

This extractor will by default attempt to detect the encoding of the a page when extracting links and referrer information. If no charset could be detected, it falls back to UTF-8. It is also possible to dictate which encoding to use with RegexLinkExtractorConfig.setCharset(java.nio.charset.Charset).

Since:
2.7.0