1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-27 19:17:43 +00:00

expr: Allow only ASCII digits for regex range quantifiers

This commit is contained in:
Teemu Pätsi 2025-05-27 17:50:44 +03:00
parent 4946922c0f
commit eb7bc2f251
No known key found for this signature in database

View file

@ -302,7 +302,7 @@ where
} }
// Check if parsed quantifier is valid // Check if parsed quantifier is valid
let re = Regex::new(r"^(\d*,\d*|\d+)$").expect("valid regular expression"); let re = Regex::new(r"^([0-9]*,[0-9]*|[0-9]+)$").expect("valid regular expression");
if let Some(captures) = re.captures(&quantifier) { if let Some(captures) = re.captures(&quantifier) {
let matched = captures.at(0).unwrap_or_default(); let matched = captures.at(0).unwrap_or_default();
match matched.split_once(',') { match matched.split_once(',') {