Advertisement
GalinaKG

02. Match Phone Number

Jul 18th, 2022
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. # 1-st decision
  2. import re
  3.  
  4. text = input()
  5.  
  6. matches = re.finditer(r"\+359([ -])2\1\d{3}\1\d{4}\b", text)
  7.  
  8. output = []
  9.  
  10. for match in matches:
  11. output.append(match.group())
  12.  
  13. print(', '.join(output))
  14.  
  15.  
  16.  
  17.  
  18. # 2-nd decision
  19. import re
  20.  
  21. text = input()
  22.  
  23. matches = re.findall(r"\+359 2 \d{3} \d{4}\b|\+359-2-\d{3}-\d{4}\b", text)
  24.  
  25. print(', '.join(matches))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement