mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2025-06-20 16:35:17 +00:00
Continue refactoring
This commit is contained in:
@ -92,4 +92,18 @@ pub fn check_youtube_id(id: &str) -> bool {
|
||||
pub fn check_emoji_code(shortcut: &str) -> bool {
|
||||
let r = Regex::new(r"^:[a-zA-Z0-9]+:$").unwrap();
|
||||
r.is_match(shortcut)
|
||||
}
|
||||
|
||||
/// Check the validity of an HTML color
|
||||
///
|
||||
/// ```
|
||||
/// use comunic_server::utils::string_utils::check_emoji_code;
|
||||
///
|
||||
/// assert_eq!(check_emoji_code("AAFF00"), true);
|
||||
/// assert_eq!(check_emoji_code("ABC"), false);
|
||||
/// assert_eq!(check_emoji_code("UUFF00"), false);
|
||||
/// ```
|
||||
pub fn check_html_color(color: &str) -> bool {
|
||||
let r = Regex::new(r"^:[A-F0-9]{6}:$").unwrap();
|
||||
r.is_match(color)
|
||||
}
|
Reference in New Issue
Block a user