summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@spawned.biz>2025-12-31 13:16:37 +0100
committerJoel Klinghed <the_jk@spawned.biz>2025-12-31 13:16:37 +0100
commit685b0e8fd95eb5f9d2ceb4bc2448c0b60a50dcba (patch)
treef62ed7af6883b606a5c0c4b0d4ffa59786a56db5 /src/main.rs
parent93e00f8acdb5808a2bafb5233d865de2017b1529 (diff)
Fix invalid capture group check
All regex:es has an implicit capture group, the whole pattern, so check for two when we mean a specific capture group.
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index 6acee28..d9e2c6e 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -75,7 +75,7 @@ fn load_config(path: &PathBuf) -> anyhow::Result<Config> {
let mut patterns_regex = Vec::with_capacity(patterns_str.len());
for pattern in patterns_str {
let regex = RegexBuilder::new(pattern).size_limit(42_000).build()?;
- if regex.captures_len() != 1 {
+ if regex.captures_len() != 2 {
return Err(anyhow!(
"Invalid pattern {}, capture groups are not one",
pattern