1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2025-06-20 16:35:17 +00:00

Continue refactoring

This commit is contained in:
2021-03-04 18:51:52 +01:00
parent 2cc8984dfa
commit fbf4728347
27 changed files with 527 additions and 355 deletions

View File

@ -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)
}