On this page
sre_constants.PatternError
Prev: sre_constants.error | Up: sre_constants
Rel: sre_constants.error
Ref: docs.python.org โ sre_constants.PatternError
Tags: #public #python3 #stdlib #sre_constants
Import
import sre_constants
from sre_constants import PatternError
Signature & Overview
sre_constants.PatternError(msg, pattern=None, pos=None)
Exception raised for invalid regular expressions.
Methods & Attributes
PatternError.add_note(self, note, /)โ Add a note to the exceptionPatternError.with_traceback(self, tb, /)โ Set self.traceback to tb and return self.
Usage
import re
# Use re.error / re.PatternError instead of deprecated sre_constants
assert issubclass(re.error, Exception)
Gotchas
- Deprecated internal shim.
REPL Inspect
from sre_constants import PatternError
help(PatternError)
Linked from
Related notes
- tuts/python3/stdlib_module/sre_constants Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/sre_constants/error Linked here; links to this page; shared tags: #stdlib
- tuts/c/stdlib shared tags: #stdlib
- tuts/c/stdlib/assert shared tags: #stdlib
- tuts/c/stdlib/assert/assert shared tags: #stdlib
- tuts/c/stdlib/assert/static_assert shared tags: #stdlib
- tuts/c/stdlib/ctype shared tags: #stdlib
- tuts/c/stdlib/ctype/isalpha shared tags: #stdlib
- tuts/c/stdlib/ctype/isdigit shared tags: #stdlib
- tuts/c/stdlib/ctype/isspace shared tags: #stdlib