mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
csplit: only allow ASCII digits for repeat pattern
This commit is contained in:
@@ -107,7 +107,7 @@ fn extract_patterns(args: &[String]) -> Result<Vec<Pattern>, CsplitError> {
|
||||
let mut patterns = Vec::with_capacity(args.len());
|
||||
let to_match_reg =
|
||||
Regex::new(r"^(/(?P<UPTO>.+)/|%(?P<SKIPTO>.+)%)(?P<OFFSET>[\+-]?\d+)?$").unwrap();
|
||||
let execute_ntimes_reg = Regex::new(r"^\{(?P<TIMES>\d+)|\*\}$").unwrap();
|
||||
let execute_ntimes_reg = Regex::new(r"^\{(?P<TIMES>[0-9]+)|\*\}$").unwrap();
|
||||
let mut iter = args.iter().peekable();
|
||||
|
||||
while let Some(arg) = iter.next() {
|
||||
|
||||
@@ -83,6 +83,15 @@ fn test_up_to_line_sequence() {
|
||||
assert_eq!(at.read("xx02"), generate(25, 51));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_up_to_line_with_non_ascii_repeat() {
|
||||
// we use a different error message than GNU
|
||||
new_ucmd!()
|
||||
.args(&["numbers50.txt", "10", "{𝟚}"])
|
||||
.fails()
|
||||
.stderr_contains("invalid pattern");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_up_to_match() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
|
||||
Reference in New Issue
Block a user