phonenumbers.re_util | index phonenumbers/re_util.py |
Additional regular expression utilities, to make it easier to sync up
with Java regular expression code.
>>> import re
>>> from .re_util import fullmatch
>>> from .util import u
>>> string = 'abcd'
>>> r1 = re.compile('abcd')
>>> r2 = re.compile('bc')
>>> r3 = re.compile('abc')
>>> fullmatch(r1, string) # doctest: +ELLIPSIS
<...Match object...>
>>> fullmatch(r2, string)
>>> fullmatch(r3, string)
>>> r = re.compile(r'\d{8}|\d{10,11}')
>>> m = fullmatch(r, '1234567890')
>>> m.end()
10
>>> r = re.compile(u(r'[++\d]'), re.UNICODE)
>>> m = fullmatch(r, u('0'))
>>> m.end()
1
Modules | ||||||
|
Functions | ||
|