Function neure::re::regex::then

source ·
pub fn then<'a, C, L, R>(left: L, right: R) -> RegexThen<C, L, R>where
    L: Regex<C>,
    R: Regex<C>,
    C: Context<'a> + Match<C>,
Expand description

First try to match L. If it succeeds, then try to match R.

Return

Return a tuple of result of L and result of R.

Example

    color_eyre::install()?;
    let val = neu::ascii_alphabetic().repeat_one_more();
    let num = neu::ascii_alphanumeric().repeat_one_more();
    let tuple = re::regex::then(val, num);

    assert_eq!(
        CharsCtx::new("abc42").try_mat_t(&tuple)?,
        (Span::new(0, 3), Span::new(3, 2))
    );
    Ok(())