Home / Function/ detect_email() — langchain Function Reference

detect_email() — langchain Function Reference

Architecture documentation for the detect_email() function in _redaction.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  08064161_e02e_d147_906c_ad2e247e0dc5["detect_email()"]
  be639235_9a02_cc2d_5a7d_637d822fb3b3["_redaction.py"]
  08064161_e02e_d147_906c_ad2e247e0dc5 -->|defined in| be639235_9a02_cc2d_5a7d_637d822fb3b3
  style 08064161_e02e_d147_906c_ad2e247e0dc5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/langchain/agents/middleware/_redaction.py lines 50–68

def detect_email(content: str) -> list[PIIMatch]:
    """Detect email addresses in content.

    Args:
        content: The text content to scan for email addresses.

    Returns:
        A list of detected email matches.
    """
    pattern = r"\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b"
    return [
        PIIMatch(
            type="email",
            value=match.group(),
            start=match.start(),
            end=match.end(),
        )
        for match in re.finditer(pattern, content)
    ]

Domain

Subdomains

Frequently Asked Questions

What does detect_email() do?
detect_email() is a function in the langchain codebase, defined in libs/langchain_v1/langchain/agents/middleware/_redaction.py.
Where is detect_email() defined?
detect_email() is defined in libs/langchain_v1/langchain/agents/middleware/_redaction.py at line 50.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free