UNPKG

1.51 kBTypeScriptView Raw
1import { Matcher, MatcherConfig } from "./matcher";
2import { HashtagServices } from "../autolinker";
3import { Match } from "../match/match";
4/**
5 * @class Autolinker.matcher.Hashtag
6 * @extends Autolinker.matcher.Matcher
7 *
8 * Matcher to find HashtagMatch matches in an input string.
9 */
10export declare class HashtagMatcher extends Matcher {
11 /**
12 * @cfg {String} serviceName
13 *
14 * The service to point hashtag matches to. See {@link Autolinker#hashtag}
15 * for available values.
16 */
17 protected readonly serviceName: HashtagServices;
18 /**
19 * The regular expression to match Hashtags. Example match:
20 *
21 * #asdf
22 *
23 * @protected
24 * @property {RegExp} matcherRegex
25 */
26 protected matcherRegex: RegExp;
27 /**
28 * The regular expression to use to check the character before a username match to
29 * make sure we didn't accidentally match an email address.
30 *
31 * For example, the string "asdf@asdf.com" should not match "@asdf" as a username.
32 *
33 * @protected
34 * @property {RegExp} nonWordCharRegex
35 */
36 protected nonWordCharRegex: RegExp;
37 /**
38 * @method constructor
39 * @param {Object} cfg The configuration properties for the Match instance,
40 * specified in an Object (map).
41 */
42 constructor(cfg: HashtagMatcherConfig);
43 /**
44 * @inheritdoc
45 */
46 parseMatches(text: string): Match[];
47}
48export interface HashtagMatcherConfig extends MatcherConfig {
49 serviceName: HashtagServices;
50}