U
    W h  ã                   @   sL   d Z ddlZddlZejdkr(dd„ Zndd„ ZedkrHddlZe ¡  dS )uF  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('ï¼'))
>>> m.end()
1
é    N)é   é   c                 C   s
   |   |¡S )ú‘Try to apply the pattern at the start of the string, returning a match
        object if the whole string matches, or None if no match was found.)Ú	fullmatch)ÚpatternÚstring© r   úV/var/www/html/arya_register/venvv2/lib/python3.8/site-packages/phonenumbers/re_util.pyr      s    r   c                 C   s:   t  d| j | j¡}| |¡}|r6| ¡ t|ƒk r6d}|S )r   z^(?:%s)$N)ÚreÚcompiler   ÚflagsÚmatchÚendÚlen)r   r   Zgrouped_patternÚmr   r   r	   r   %   s
    
Ú__main__)Ú__doc__r
   ÚsysÚversion_infor   Ú__name__ÚdoctestÚtestmodr   r   r   r	   Ú<module>   s   

