On this page
sre_compile.PatternError
Prev: sre_compile.isstring | Up: sre_compile
Rel: sre_compile.compile, sre_compile.dis, sre_compile.error, sre_compile.isstring
Ref: docs.python.org โ sre_compile.PatternError
Tags: #public #python3 #stdlib #sre_compile
Import
import sre_compile
from sre_compile import PatternError
Signature & Overview
sre_compile.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
# Deprecated internal shim; catch re.error (or re.PatternError in 3.13+)
assert issubclass(re.error, Exception)
Gotchas
- Deprecated: Never import
sre_compilein new code.
REPL Inspect
from sre_compile import PatternError
help(PatternError)
Linked from
Related notes
- tuts/python3/stdlib_module/sre_compile Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/sre_compile/compile Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/sre_compile/dis Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/sre_compile/error Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/sre_compile/isstring 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