Function neure::re::regex::and

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

Match P1 then P2.

Example

    color_eyre::install()?;
    let ip = re::string("127.0.0.1");
    let colon = ':'.repeat_one();
    let port = neu::digit(10).repeat_one_more();
    let local = ip.then(colon).then(port);
    let mut ctx = CharsCtx::new("127.0.0.1:8080");

    assert_eq!(ctx.try_mat(&local)?, Span::new(0, 14));
    Ok(())