Skip to content

Emoji group matches digits #704

Closed
Closed
@Gegy

Description

@Gegy

Using regex 1.3.9, matching with the \p{Emoji} group yields matches on digits as well as emoji. As far as I could tell, this isn't intentional.

Example to reproduce issue:

use regex::Regex;

fn main() {
    let match_emoji = Regex::new(r#"\p{Emoji}"#).unwrap();

    let matches = match_emoji.find_iter("hello! 😀 😁 1234")
        .map(|m| m.as_str())
        .collect::<Vec<_>>();

    println!("{:?}", matches);
}

This prints ["😀", "😁", "1", "2", "3", "4"], where I'd expect it to print just ["😀", "😁"]

Not totally sure if I'm misinterpreted the intended use of the Emoji group. For now using the pattern [\p{Emoji}--\p{Digit}] is a functioning workaround. 🙂

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions