Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Extend PatternMatch Class to Implement US Postal Code and Phone Number #579

Open
jasonhorner opened this issue Sep 8, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@jasonhorner
Copy link

Is your feature request related to a problem? Please describe.

The PatternMatch analyzer in Deequ currently lacks support for validating common US data formats, such as phone numbers and postal codes. This forces users to implement custom regex validation, leading to inconsistent implementations.

Describe the solution you'd like

Add built-in support for validating US phone numbers and postal codes using the following regex patterns:

  1. US Phone Number Regex:

    val PHONE_NUMBER_US: Regex = """^(?:\+1\s?)?(?:\(?[2-9][0-9]{2}\)?[\s-]?)?[2-9][0-9]{2}[\s-]?[0-9]{4}(?:\s?(?:ext|x|extension)\s?[0-9]{4})?$""".r
  2. US Postal Code Regex:

    val POSTAL_CODE_US: Regex = """\b\d{5}(?:-\d{4})?\b""".r

Describe alternatives you've considered

Custom regex implementations, but these add complexity and inconsistency across projects.

Additional context

These patterns are commonly used in US data validation (e.g., customer records, shipping data). Including them in Deequ would simplify validation workflows.

Additionally, the current codebase has limited unit tests and lacks examples demonstrating the use of PatternMatch.

@jasonhorner jasonhorner added the enhancement New feature or request label Sep 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant