diff --git a/src/main.rs b/src/main.rs index 6990b0a..e1c7f67 100644 --- a/src/main.rs +++ b/src/main.rs @@ -330,7 +330,7 @@ impl DataSurgeon { ("credit_card", Regex::new(r"\b(\d{4}[- ]?\d{4}[- ]?\d{4}[- ]?\d{4})\b").unwrap()), ("email", Regex::new(r"\b([A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4})\b").unwrap()), ("url", Regex::new(r#"(https?://(?:[^\s.,;:"'<>()\[\]{}]+\.)*[^\s.,;:"'<>()\[\]{}]+(/[^\s]*[^\s.,;:"'<>()\[\]{}\s])?)"#).unwrap()), - ("ip_address", Regex::new(r"\b((?:\d{1,3}\.){3}\d{1,3}(?:/\d{1,2})?)\b").unwrap()), + ("ip_address", Regex::new(r"\b((?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d)\.(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d)|(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d)\.(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d)\.(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d))(?::\d{1,5})?)\b").unwrap()), ("social_security", Regex::new(r"\b(\d{3}-\d{2}-\d{4})\b").unwrap()), ("phone_number", Regex::new(r"(\b[2-9]\d{2}-\d{3}-\d{4}\b)").unwrap()), ("ipv6_address", Regex::new(r"((?:[0-9a-fA-F]{1,4}:){1,7}[0-9a-fA-F]{1,4}|(?:[0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|(?:[0-9a-fA-F]{1,4}:){1,5}(?::[0-9a-fA-F]{1,4}){1,2}|(?:[0-9a-fA-F]{1,4}:){1,4}(?::[0-9a-fA-F]{1,4}){1,3}|(?:[0-9a-fA-F]{1,4}:){1,3}(?::[0-9a-fA-F]{1,4}){1,4}|(?:[0-9a-fA-F]{1,4}:){1,2}(?::[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:(?:(?::[0-9a-fA-F]{1,4}){1,6})|:(?:(?::[0-9a-fA-F]{1,4}){1,7}|:))(?:/\d{1,3})?").unwrap()),