fork download
  1. import re
  2. s = "I will be out of the office. Please send me an email and text my mobile +45\n20 32 40 08 if any urgency."
  3. reg_phonestyle = re.compile(r'(\d{2}[-/.\s]*\d{2}[-/.\s]*\d{2}[-/.\s]*\d{2}[-/.\s]*\d{2}|\(\d{3}\)\s*\d{3}[-/.\s]*\d{4}|\d{3}[-/.\s]*\d{4})')
  4. m = reg_phonestyle.search(s)
  5. if m:
  6. print(re.sub(r'\s+', '', m.group()))
Success #stdin #stdout 0.02s 27712KB
stdin
Standard input is empty
stdout
4520324008