#1887·nom

Recognize doesn't work with tuple

Author: RunBoltCreated Jul 13, 2026Updated Sep 13, 2026

Environment

toml
nom = "8.0.0"

Problem

When using recognize((satisfy(|c| c.is_uppercase()), alpha0)) parser, this produces only the first character of Hello.

rust
        #[test]
        fn test_name() {
            let testing = || -> IResult<_, _> {
                recognize((satisfy(|c: char| c.is_uppercase()), alpha0)).parse("Hello")
            };
            let (rest, name) = testing().unwrap();
            println!("Name: {name:?}");
            println!("Rest: {rest:?}");
        }

This prints:

Name: "H"
Rest: ""

When I change it to use just the inner tuple: (satisfy(|c: char| c.is_uppercase()), alpha0)

Name: ('H', "ello")
Rest: ""