On this page
sre_compile.compile
Up: sre_compile | Next: sre_compile.dis
Rel: sre_compile.dis, sre_compile.error, sre_compile.isstring, sre_compile.PatternError
Ref: docs.python.org — sre_compile.compile
Tags: #public #python3 #stdlib #sre_compile
Import
import sre_compile
from sre_compile import compile
Signature & Overview
sre_compile.compile(p, flags=0)
sre_compile.compile() function.
Usage
import re
# Use re.compile() instead of deprecated sre_compile.compile()
assert re.compile(r'\d+').fullmatch('42') is not None
Gotchas
- Deprecated internal shim.
REPL Inspect
from sre_compile import compile
help(compile)
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/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/python3/stdlib_module/sre_compile/PatternError 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