In [ ]:
import re
patt = re.compile( # TODO )
assert(patt.match("123"))
assert(patt.match("123ab") is None)
In [ ]:
patt = # TODO
assert(patt.match("+36301234567"))
assert(patt.match("+37000000000") is None)
assert(patt.match("+363012345678") is None)
In [ ]:
patt = # TODO
assert(patt.match("+36301234567"))
assert(patt.match("+37000000000") is None)
assert(patt.match("+363012345678") is None)
assert(patt.match("+36 30 123 4566"))
assert(patt.match("+36-30-123-4566"))
assert(patt.match("+36-30-123-45667") is None)
In [ ]:
patt = # TODO
assert(patt.match("1.9"))
assert(patt.match("1.9.2") is None)
In [ ]:
patt = # TODO
assert(patt.match("abc@example.com"))
assert(patt.match("abc") is None)
assert(patt.match("abc@example@example.com") is None)
In [ ]:
patt = # TODO
assert(patt.match("0xa"))
assert(patt.match("0x16FA"))
assert(patt.match("16FA") is None)
assert(patt.match("0x16FG") is None)
In [ ]:
patt = # TODO
assert(patt.sub("", "(a)bc") == "bc")
assert(patt.sub("", "abc") == "abc")
assert(patt.sub("", "a (bc) de (12)") == "a de ")
In [ ]:
patt = # TODO
assert(patt.split("simple sentence.") == ["simple", "sentence", ""])
assert(patt.split("multiple \t whitespaces") == ["multiple", "whitespaces"])