Category: re

Problem

Pull patterns from text with re.

Solution

  emails = re.findall(r"[\w.-]+@[\w.-]+", text)
  

Notes

  • Adapt variable names and paths to your project
  • Add error handling for production use
  • See related chapters in the Learning Path