Alle Dateien aus dem Pythonkurs
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

22 lines
356 B

import re
import unittest
class RegEx(unittest.TestCase):
pattern_phone = re.compile(r'\D')
pattern_digits_only = re.compile(r'\d')
def test_phone(self):
m = self.pattern_phone.sub('','+1 (212) 555-6832')
self.assertIsNotNone(self.pattern_digits_only.match(m))
print(f'm={m}')
if __name__ == '__main__':
unittest.main()