phone.py
This commit is contained in:
22
regex/phone.py
Normal file
22
regex/phone.py
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
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()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in New Issue
Block a user