forked from jmug/stoatchat
fix: add case-insensitive flag to colour regex
This commit is contained in:
@@ -5,6 +5,9 @@ use regex::Regex;
|
|||||||
///
|
///
|
||||||
/// Allows the use of named colours, rgb(a), variables and all gradients.
|
/// Allows the use of named colours, rgb(a), variables and all gradients.
|
||||||
///
|
///
|
||||||
|
/// Flags:
|
||||||
|
/// - Case-insensitive (`i`)
|
||||||
|
///
|
||||||
/// Source:
|
/// Source:
|
||||||
/// ```regex
|
/// ```regex
|
||||||
/// VALUE = [a-z ]+|var\(--[a-z\d-]+\)|rgba?\([\d, ]+\)|#[a-f0-9]+
|
/// VALUE = [a-z ]+|var\(--[a-z\d-]+\)|rgba?\([\d, ]+\)|#[a-f0-9]+
|
||||||
@@ -14,5 +17,5 @@ use regex::Regex;
|
|||||||
/// ^(?:VALUE|(repeating-)?(linear|conic|radial)-gradient\((VALUE|ADDITIONAL_VALUE)STOP(,[ ]*(VALUE)STOP)+\))$
|
/// ^(?:VALUE|(repeating-)?(linear|conic|radial)-gradient\((VALUE|ADDITIONAL_VALUE)STOP(,[ ]*(VALUE)STOP)+\))$
|
||||||
/// ```
|
/// ```
|
||||||
pub static RE_COLOUR: Lazy<Regex> = Lazy::new(|| {
|
pub static RE_COLOUR: Lazy<Regex> = Lazy::new(|| {
|
||||||
Regex::new(r"^(?:[a-z ]+|var\(--[a-z\d-]+\)|rgba?\([\d, ]+\)|#[a-f0-9]+|(repeating-)?(linear|conic|radial)-gradient\(([a-z ]+|var\(--[a-z\d-]+\)|rgba?\([\d, ]+\)|#[a-f0-9]+|\d+deg)([ ]+(\d{1,3}%|0))?(,[ ]*([a-z ]+|var\(--[a-z\d-]+\)|rgba?\([\d, ]+\)|#[a-f0-9]+)([ ]+(\d{1,3}%|0))?)+\))$").unwrap()
|
Regex::new(r"(?i)^(?:[a-z ]+|var\(--[a-z\d-]+\)|rgba?\([\d, ]+\)|#[a-f0-9]+|(repeating-)?(linear|conic|radial)-gradient\(([a-z ]+|var\(--[a-z\d-]+\)|rgba?\([\d, ]+\)|#[a-f0-9]+|\d+deg)([ ]+(\d{1,3}%|0))?(,[ ]*([a-z ]+|var\(--[a-z\d-]+\)|rgba?\([\d, ]+\)|#[a-f0-9]+)([ ]+(\d{1,3}%|0))?)+\))$").unwrap()
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user