forked from daviddrysdale/python-phonenumbers
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathphonenumbers.re_util.html
More file actions
52 lines (49 loc) · 3.37 KB
/
Copy pathphonenumbers.re_util.html
File metadata and controls
52 lines (49 loc) · 3.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module phonenumbers.re_util</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head><body bgcolor="#f0f0f8">
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong><a href="phonenumbers.html"><font color="#ffffff">phonenumbers</font></a>.re_util</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="https://github.com/daviddrysdale/python-phonenumbers/blob/dev/python/phonenumbers/re_util.py">phonenumbers/re_util.py</a></font></td></tr></table>
<p><tt>Additional regular expression utilities, to make it easier to sync up<br>
with Java regular expression code.<br>
<br>
>>> import re<br>
>>> from .re_util import fullmatch<br>
>>> from .util import u<br>
>>> string = 'abcd'<br>
>>> r1 = re.compile('abcd')<br>
>>> r2 = re.compile('bc')<br>
>>> r3 = re.compile('abc')<br>
>>> <a href="#-fullmatch">fullmatch</a>(r1, string) # doctest: +ELLIPSIS<br>
<...Match object...><br>
>>> <a href="#-fullmatch">fullmatch</a>(r2, string)<br>
>>> <a href="#-fullmatch">fullmatch</a>(r3, string)<br>
>>> r = re.compile(r'\d{8}|\d{10,11}')<br>
>>> m = <a href="#-fullmatch">fullmatch</a>(r, '1234567890')<br>
>>> m.end()<br>
10<br>
>>> r = re.compile(u(r'[++\d]'), re.UNICODE)<br>
>>> m = <a href="#-fullmatch">fullmatch</a>(r, u('0'))<br>
>>> m.end()<br>
1</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
<tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="re.html">re</a><br>
</td><td width="25%" valign=top></td><td width="25%" valign=top></td><td width="25%" valign=top></td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#eeaa77">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
<tr><td bgcolor="#eeaa77"><tt> </tt></td><td> </td>
<td width="100%"><dl><dt><a name="-fullmatch"><strong>fullmatch</strong></a>(pattern, string, flags=0)</dt><dd><tt>Try to apply the pattern at the start of the string, returning a match<br>
object if the whole string matches, or None if no match was found.</tt></dd></dl>
</td></tr></table>
</body></html>