chore(patterns): add nix-shas

This commit is contained in:
technofab 2025-06-10 15:56:25 +02:00
parent dd44213879
commit 0ea17e1f68
No known key found for this signature in database
2 changed files with 4 additions and 1 deletions

View file

@ -11,7 +11,7 @@ pub(super) const EXCLUDE_PATTERNS: [(&str, &str); 1] =
///
/// The email address was obtained at https://www.regular-expressions.info/email.html.
/// Some others were obtained from Ferran Basora, the rest is by me.
pub(super) const PATTERNS: [(&str, &str); 21] = [
pub(super) const PATTERNS: [(&str, &str); 22] = [
("markdown-url", r"\[[^]]*\]\(([^)]+)\)"),
(
"url",
@ -48,6 +48,7 @@ pub(super) const PATTERNS: [(&str, &str); 21] = [
"command-line-args",
r#"(?:--[a-z][0-9a-z\-_]+|-[a-z])(?: |=)([^-\s\n]\S+)"#,
),
("nix-shas", r#"((sha256|sha512)-[a-zA-Z0-9+/=]{44})"#),
];
/// Type-safe string Pattern Name (newtype).

View file

@ -82,6 +82,8 @@ setup_pattern_binding "p" "--pattern-name path"
setup_pattern_binding "P" "--pattern-name pointer-address"
# prefix + t + q searches for strings inside single|double|backticks
setup_pattern_binding "q" "-x quoted-single -x quoted-double -x quoted-backtick"
# prefix + t + s searches for nix shas
setup_pattern_binding "s" "--pattern-name nix-shas"
# prefix + t + u searches for URLs
setup_pattern_binding "u" "--pattern-name url"
# prefix + t + U searches for UUIDs