Skip to main content

parse_links

Function parse_links 

Source
pub(crate) fn parse_links<T>(
    text: &str,
    regex: &Regex,
    parse: impl Fn(&Captures<'_>) -> Option<T>,
) -> Vec<T>
Expand description

Extracts links matching regex from text, applying the shared link policy: URLs wrapped in angle brackets (e.g. <https://...>) are skipped, duplicate URLs are ignored, and at most MAX_LINKS_PER_MESSAGE links are returned.

parse converts a regex match into the expander-specific link type; returning None drops that match.