pub const HASHES_RE_STR: &str = r"[\u{23}\u{FE5F}\u{FF03}]";
Expand description
The three kinds of hash allowed by the unicode standard.
All three of them are escaped even though they’re printable.
This is because I’m using multi-line regex syntax and that
uses the '#'
character for comments.
This can be useful when checking that a text does not contain a hash, especially when checking emojis.
Note that some emojis contain hash code points:
§Examples
let hash_re = Regex::new(HASHES_RE_STR).unwrap();
let input = "#️⃣";
// This is the same string:
let input_escaped = "\u{1b}\u{5b}\u{32}\u{30}\u{30}\u{7e}\u{23}\u{fe0f}\u{20e3}";
// Note the '\u{23}' which is the code point of '#'
assert!(input.contains("#"));
assert!(hash_re.is_match(&input));
assert!(hash_re.is_match(&input_escaped));