Skip to content

Conversation

@DivInstance
Copy link

@DivInstance DivInstance commented Oct 6, 2025

Summary

This PR reduces false positives in email detection used across Slash by replacing the very loose \S+@\S+ with a stricter, centralized regex.

Changes

  • Add EMAIL_RE in api/extract.py
    • Pattern: \b[a-zA-Z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b
  • Update extract.mail()

Rationale

The previous pattern matched tokens with trailing punctuation or random strings containing @, causing misclassification (e.g., treating the input as an email when it’s not). The new pattern aligns with common email formats and reduces noise.

Testing

Impact

Improves accuracy for flows that depend on [extract.just.mail()]

Checklist

  • Centralized email regex
  • Updated both email extraction methods
  • Manual smoke tests for positives and negatives

Resolves #2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

False Positive with Email Address

1 participant