Skip to content

Commit

Permalink
we don't need to handle invalid posix regex
Browse files Browse the repository at this point in the history
  • Loading branch information
tangowithfoxtrot committed Jul 16, 2024
1 parent 4a5aeb3 commit 5bdf99c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions crates/bws/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ use uuid::Uuid;
const VALID_POSIX_NAME_REGEX: &str = "^[a-zA-Z_][a-zA-Z0-9_]*$";

pub(crate) fn is_valid_posix_name(input_text: &str) -> bool {
match Regex::new(VALID_POSIX_NAME_REGEX) {
Ok(r) => r.is_match(input_text),
Err(_) => false,
}
Regex::new(VALID_POSIX_NAME_REGEX)
.expect("VALID_POSIX_NAME_REGEX to be a valid regex")
.is_match(input_text)
}

/// Converts a UUID to a POSIX-compliant environment variable name.
Expand Down

0 comments on commit 5bdf99c

Please sign in to comment.