// include the latest version of the regex crate in your Cargo.toml
extern crate regex;
use regex::Regex;
fn main() {
let regex = Regex::new(r"(?m)(π¨)(?:([π»πΌπ½πΎπΏ])?(\x{200D}[π¦°π¦±π¦³π¦²])?\x{FE0F}?)?").unwrap();
let string = "Codepoints
π¨ U+1F468
Shortcodes
:man:
Related
π¨ Man
π¨π» Man: Light Skin Tone
π¨πΌ Man: Medium-Light Skin Tone
π¨π½ Man: Medium Skin Tone
π¨πΎ Man: Medium-Dark Skin Tone
π¨πΏ Man: Dark Skin Tone
π© Woman
π©π» Woman: Light Skin Tone
π©πΌ Woman: Medium-Light Skin Tone
π©π½ Woman: Medium Skin Tone
π©πΎ Woman: Medium-Dark Skin Tone
π©πΏ Woman: Dark Skin Tone
See also
π§ Man: Beard
π§π» Man: Light Skin Tone, Beard
π§πΌ Man: Medium-Light Skin Tone, Beard
π§π½ Man: Medium Skin Tone, Beard
π§πΎ Man: Medium-Dark Skin Tone, Beard
π§πΏ Man: Dark Skin Tone, Beard
π¨β𦳠Man: White Hair
π¨π»β𦳠Man: Light Skin Tone, White Hair
π¨πΌβ𦳠Man: Medium-Light Skin Tone, White Hair
π¨π½β𦳠Man: Medium Skin Tone, White Hair
π¨πΎβ𦳠Man: Medium-Dark Skin Tone, White Hair
π¨πΏβ𦳠Man: Dark Skin Tone, White Hair
π©β𦳠Woman: White Hair
π©π»β𦳠Woman: Light Skin Tone, White Hair
π©πΌβ𦳠Woman: Medium-Light Skin Tone, White Hair
π©π½β𦳠Woman: Medium Skin Tone, White Hair
π©πΎβ𦳠Woman: Medium-Dark Skin Tone, White Hair
π©πΏβ𦳠Woman: Dark Skin Tone, White Hair
π¨βπ¦° Man: Red Hair
π¨π»βπ¦° Man: Light Skin Tone, Red Hair
π¨πΌβπ¦° Man: Medium-Light Skin Tone, Red Hair
π¨π½βπ¦° Man: Medium Skin Tone, Red Hair
π¨πΎβπ¦° Man: Medium-Dark Skin Tone, Red Hair
π¨πΏβπ¦° Man: Dark Skin Tone, Red Hair
π©βπ¦° Woman: Red Hair
π©π»βπ¦° Woman: Light Skin Tone, Red Hair
π©πΌβπ¦° Woman: Medium-Light Skin Tone, Red Hair
π©π½βπ¦° Woman: Medium Skin Tone, Red Hair
π©πΎβπ¦° Woman: Medium-Dark Skin Tone, Red Hair
π©πΏβπ¦° Woman: Dark Skin Tone, Red Hair
π¦ Boy
β Male Sign
πΊ Man Dancing
π² Man With Chinese Cap
π΄ Man in Suit Levitating
π€΅ Man in Tuxedo
π΄ Old Man
π΅ Old Woman
π
Santa Claus";
// result will be an iterator over tuples containing the start and end indices for each match in the string
let result = regex.captures_iter(string);
for mat in result {
println!("{:?}", mat);
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Rust, please visit: https://docs.rs/regex/latest/regex/