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

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

Issue 22578: Add addition attributes to re.error
Patch Set: Created 5 years 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') | no next file with comments »
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 714 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 725
726 .. versionchanged:: 3.3 726 .. versionchanged:: 3.3
727 The ``'_'`` character is no longer escaped. 727 The ``'_'`` character is no longer escaped.
728 728
729 729
730 .. function:: purge() 730 .. function:: purge()
731 731
732 Clear the regular expression cache. 732 Clear the regular expression cache.
733 733
734 734
735 .. exception:: error 735 .. exception:: error(msg, pattern=None, pos=None)
736 736
737 Exception raised when a string passed to one of the functions here is not a 737 Exception raised when a string passed to one of the functions here is not a
738 valid regular expression (for example, it might contain unmatched parentheses ) 738 valid regular expression (for example, it might contain unmatched parentheses )
739 or when some other error occurs during compilation or matching. It is never an 739 or when some other error occurs during compilation or matching. It is never an
740 error if a string contains no match for a pattern. 740 error if a string contains no match for a pattern. The error instance has
741 the following additional attributes:
741 742
743 .. attribute:: msg
744
745 The unformatted error message.
746
747 .. attribute:: pattern
748
749 The regular expression pattern.
750
751 .. attribute:: pos
752
753 The index of *pattern* where compilation failed.
754
755 .. attribute:: lineno
756
757 The line corresponding to *pos*.
758
759 .. attribute:: colno
760
761 The column corresponding to *pos*.
762
763 .. versionchanged:: 3.5
764 Added additional attributes.
742 765
743 .. _re-objects: 766 .. _re-objects:
744 767
745 Regular Expression Objects 768 Regular Expression Objects
746 -------------------------- 769 --------------------------
747 770
748 Compiled regular expression objects support the following methods and 771 Compiled regular expression objects support the following methods and
749 attributes: 772 attributes:
750 773
751 .. method:: regex.search(string[, pos[, endpos]]) 774 .. method:: regex.search(string[, pos[, endpos]])
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
1396 Token(typ='ID', value='quantity', line=3, column=33) 1419 Token(typ='ID', value='quantity', line=3, column=33)
1397 Token(typ='END', value=';', line=3, column=41) 1420 Token(typ='END', value=';', line=3, column=41)
1398 Token(typ='ID', value='tax', line=4, column=8) 1421 Token(typ='ID', value='tax', line=4, column=8)
1399 Token(typ='ASSIGN', value=':=', line=4, column=12) 1422 Token(typ='ASSIGN', value=':=', line=4, column=12)
1400 Token(typ='ID', value='price', line=4, column=15) 1423 Token(typ='ID', value='price', line=4, column=15)
1401 Token(typ='OP', value='*', line=4, column=21) 1424 Token(typ='OP', value='*', line=4, column=21)
1402 Token(typ='NUMBER', value='0.05', line=4, column=23) 1425 Token(typ='NUMBER', value='0.05', line=4, column=23)
1403 Token(typ='END', value=';', line=4, column=27) 1426 Token(typ='END', value=';', line=4, column=27)
1404 Token(typ='ENDIF', value='ENDIF', line=5, column=4) 1427 Token(typ='ENDIF', value='ENDIF', line=5, column=4)
1405 Token(typ='END', value=';', line=5, column=9) 1428 Token(typ='END', value=';', line=5, column=9)
OLDNEW
« no previous file with comments | « no previous file | Lib/sre_constants.py » ('j') | no next file with comments »

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