Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(122485)

Side by Side Diff: Doc/library/re.rst

Issue 22578: Add addition attributes to re.error
Patch Set: Created 5 years, 1 month ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | Lib/sre_constants.py » ('j') | Lib/sre_parse.py » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 :mod:`re` --- Regular expression operations 1 :mod:`re` --- Regular expression operations
2 =========================================== 2 ===========================================
3 3
4 .. module:: re 4 .. module:: re
5 :synopsis: Regular expression operations. 5 :synopsis: Regular expression operations.
6 .. moduleauthor:: Fredrik Lundh <fredrik@pythonware.com> 6 .. moduleauthor:: Fredrik Lundh <fredrik@pythonware.com>
7 .. sectionauthor:: Andrew M. Kuchling <amk@amk.ca> 7 .. sectionauthor:: Andrew M. Kuchling <amk@amk.ca>
8 8
9 9
10 This module provides regular expression matching operations similar to 10 This module provides regular expression matching operations similar to
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 719
720 .. versionchanged:: 3.3 720 .. versionchanged:: 3.3
721 The ``'_'`` character is no longer escaped. 721 The ``'_'`` character is no longer escaped.
722 722
723 723
724 .. function:: purge() 724 .. function:: purge()
725 725
726 Clear the regular expression cache. 726 Clear the regular expression cache.
727 727
728 728
729 .. exception:: error 729 .. exception:: error(msg, pattern=None, pos=None)
730 730
731 Exception raised when a string passed to one of the functions here is not a 731 Exception raised when a string passed to one of the functions here is not a
732 valid regular expression (for example, it might contain unmatched parentheses ) 732 valid regular expression (for example, it might contain unmatched parentheses )
733 or when some other error occurs during compilation or matching. It is never an 733 or when some other error occurs during compilation or matching. It is never an
734 error if a string contains no match for a pattern. 734 error if a string contains no match for a pattern. The error instance has
735 the following additional attributes:
735 736
737 .. attribute:: msg
738
739 The unformatted error message
ezio.melotti 2014/10/08 14:58:20 Isn't this equivalent to str(err)? If it is and y
storchaka 2014/10/08 19:36:19 No, this is not equivalent, it doesn't include an
740
741 .. attribute:: pattern
742
743 The regular expression pattern.
ezio.melotti 2014/10/08 14:58:20 This is the only sentence with a full stop at the
storchaka 2014/10/08 19:36:19 Indeed. All other sentences are copied from simple
744
745 .. attribute:: pos
746
747 The index of *pattern* where compilation failed
748
749 .. attribute:: lineno
750
751 The line corresponding to *pos*
752
753 .. attribute:: colno
754
755 The column corresponding to *pos*
756
757 .. versionchanged:: 3.5
758 Added additional attributes.
736 759
737 .. _re-objects: 760 .. _re-objects:
738 761
739 Regular Expression Objects 762 Regular Expression Objects
740 -------------------------- 763 --------------------------
741 764
742 Compiled regular expression objects support the following methods and 765 Compiled regular expression objects support the following methods and
743 attributes: 766 attributes:
744 767
745 .. method:: regex.search(string[, pos[, endpos]]) 768 .. method:: regex.search(string[, pos[, endpos]])
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after
1388 Token(typ='ID', value='quantity', line=3, column=33) 1411 Token(typ='ID', value='quantity', line=3, column=33)
1389 Token(typ='END', value=';', line=3, column=41) 1412 Token(typ='END', value=';', line=3, column=41)
1390 Token(typ='ID', value='tax', line=4, column=8) 1413 Token(typ='ID', value='tax', line=4, column=8)
1391 Token(typ='ASSIGN', value=':=', line=4, column=12) 1414 Token(typ='ASSIGN', value=':=', line=4, column=12)
1392 Token(typ='ID', value='price', line=4, column=15) 1415 Token(typ='ID', value='price', line=4, column=15)
1393 Token(typ='OP', value='*', line=4, column=21) 1416 Token(typ='OP', value='*', line=4, column=21)
1394 Token(typ='NUMBER', value='0.05', line=4, column=23) 1417 Token(typ='NUMBER', value='0.05', line=4, column=23)
1395 Token(typ='END', value=';', line=4, column=27) 1418 Token(typ='END', value=';', line=4, column=27)
1396 Token(typ='ENDIF', value='ENDIF', line=5, column=4) 1419 Token(typ='ENDIF', value='ENDIF', line=5, column=4)
1397 Token(typ='END', value=';', line=5, column=9) 1420 Token(typ='END', value=';', line=5, column=9)
OLDNEW
« no previous file with comments | « no previous file | Lib/sre_constants.py » ('j') | Lib/sre_parse.py » ('J')

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+