java.lang.Object
org.nibor.autolink.internal.EmailScanner
- All Implemented Interfaces:
Scanner
Scan for email address starting from the trigger character "@".
Based on RFC 6531, but also scans invalid IDN. Doesn't match IP address in domain part or quoting in local part.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate int
findFirst
(CharSequence input, int beginIndex, int rewindIndex) private int
findLast
(CharSequence input, int beginIndex) private boolean
localAtomAllowed
(char c) scan
(CharSequence input, int triggerIndex, int rewindIndex) private boolean
subDomainAllowed
(char c)
-
Field Details
-
domainMustHaveDot
private final boolean domainMustHaveDot
-
-
Constructor Details
-
EmailScanner
public EmailScanner(boolean domainMustHaveDot)
-
-
Method Details
-
scan
- Specified by:
scan
in interfaceScanner
- Parameters:
input
- input texttriggerIndex
- the index at which the trigger character for this scanner wasrewindIndex
- the index that can maximally be rewound to (either the very first character of the input or the character after the last matched link) need to be set to be set here- Returns:
- the matched link, or
null
if no link matched
-
findFirst
-
findLast
-
localAtomAllowed
private boolean localAtomAllowed(char c) -
subDomainAllowed
private boolean subDomainAllowed(char c)
-