Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re
- numbers = input()
- pattern = r"\+359-2-\d{3}-\d{4}\b|\+359 2 \d{3} \d{4}\b"
- print(', '.join(re.findall(pattern, numbers)))
- ==============================================
- import re
- numbers = input()
- pattern = r'\+359(-|\s)2(\1)[0-9]{3}(\1)[0-9]{4}\b'
- matches = re.finditer(pattern, numbers)
- for match in matches:
- print(match.group())
Add Comment
Please, Sign In to add comment