feat: add discriminator and display name fields

This commit is contained in:
Paul Makles
2023-06-09 16:34:18 +01:00
parent aba5c7d8af
commit 31c7dc0577
16 changed files with 229 additions and 64 deletions

View File

@@ -1,12 +1,17 @@
use once_cell::sync::Lazy;
use regex::Regex;
/// Regex for valid display names
///
/// Block zero width space
/// Block newline and carriage return
pub static RE_DISPLAY_NAME: Lazy<Regex> = Lazy::new(|| Regex::new(r"^[^\u200B\n\r]+$").unwrap());
/// Regex for valid usernames
///
/// Block zero width space
/// Block lookalike characters
pub static RE_USERNAME: Lazy<Regex> =
Lazy::new(|| Regex::new(r"^[^\u200BА-Яа-яΑ-Ωα-ω@#:\n\r\[\]]+$").unwrap());
pub static RE_USERNAME: Lazy<Regex> = Lazy::new(|| Regex::new(r"^(\p{L}|[\d_.-])+$").unwrap());
/// Regex for valid emoji names
///