pub fn or<'a, C, O, L, R>(left: L, right: R) -> RegexOr<C, L, R>where
O: Ret,
L: Regex<C, Ret = O>,
R: Regex<C, Ret = O>,
C: Context<'a> + Match<C>,Expand description
Match P1 or P2.
Example
color_eyre::install()?;
let name = re::string("localhost");
let ip = re::string("127.0.0.1");
let local = name.or(ip);
let local = local.then(":8080");
let mut ctx = CharsCtx::new("127.0.0.1:8080");
assert_eq!(ctx.try_mat(&local)?, Span::new(0, 14));
let mut ctx = CharsCtx::new("localhost:8080");
assert_eq!(ctx.try_mat(&local)?, Span::new(0, 14));
Ok(())