On this page
  1. sre_compile.PatternError
  2. Import
  3. Signature & Overview
  4. Methods & Attributes
  5. Usage
  6. Gotchas
  7. REPL Inspect

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

Usage

import re

# Deprecated internal shim; catch re.error (or re.PatternError in 3.13+)
assert issubclass(re.error, Exception)

Gotchas

REPL Inspect

from sre_compile import PatternError
help(PatternError)

Linked from

Related notes