Package org.htmlparser.filters
Class LinkRegexFilter
java.lang.Object
org.htmlparser.filters.LinkRegexFilter
- All Implemented Interfaces:
Serializable
,Cloneable
,NodeFilter
This class accepts tags of class LinkTag that contain a link matching a given
regex pattern. Use this filter to extract LinkTag nodes with URLs that match
the desired regex pattern.
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionLinkRegexFilter
(String regexPattern) Creates a LinkRegexFilter that accepts LinkTag nodes containing a URL that matches the supplied regex pattern.LinkRegexFilter
(String regexPattern, boolean caseSensitive) Creates a LinkRegexFilter that accepts LinkTag nodes containing a URL that matches the supplied regex pattern. -
Method Summary
-
Field Details
-
mRegex
The regular expression to use on the link.
-
-
Constructor Details
-
LinkRegexFilter
Creates a LinkRegexFilter that accepts LinkTag nodes containing a URL that matches the supplied regex pattern. The match is case insensitive.- Parameters:
regexPattern
- The pattern to match.
-
LinkRegexFilter
Creates a LinkRegexFilter that accepts LinkTag nodes containing a URL that matches the supplied regex pattern.- Parameters:
regexPattern
- The regex pattern to match.caseSensitive
- Specifies case sensitivity for the matching process.
-
-
Method Details
-
accept
Accept nodes that are a LinkTag and have a URL that matches the regex pattern supplied in the constructor.- Specified by:
accept
in interfaceNodeFilter
- Parameters:
node
- The node to check.- Returns:
true
if the node is a link with the pattern.
-