Skip to content

Email validation regex is incorrect #1481

@ChristianLempa

Description

@ChristianLempa

The email validation regex in cli/core/variable.py line 12 is malformed:

EMAIL_REGEX = re.compile(r"^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$")

The double backslashes are causing it to match literal backslash-s characters instead of whitespace. It should be:

EMAIL_REGEX = re.compile(r"^[^@\s]+@[^@\s]+\.[^@\s]+$")

This causes email validation to fail for all valid email addresses like [email protected].

Steps to reproduce:

  1. Create a template with an email type variable with default [email protected]
  2. Run compose validate
  3. Validation fails with "value must be a valid email address"

Expected behavior:
Standard email addresses should pass validation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    problemFixing a problem

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions