On this page
re.RegexFlag
Prev: re.purge | Up: re | Next: re.search
Rel: re.compile, re.error, re.escape, re.findall
Ref: docs.python.org — re.RegexFlag
Tags: #public #python3 #stdlib #re
Import
import re
from re import RegexFlag
Signature & Overview
re.RegexFlag(*values)
An enumeration.
Methods & Attributes
RegexFlag.as_integer_ratio(self, /)— Return a pair of integers, whose ratio is equal to the original int.RegexFlag.bit_count(self, /)— Number of ones in the binary representation of the absolute value of self.RegexFlag.bit_length(self, /)— Number of bits necessary to represent self in binary.RegexFlag.conjugate(self, /)— Returns self, the complex conjugate of any int.RegexFlag.from_bytes(bytes, byteorder='big', *, signed=False)— Return the integer represented by the given array of bytes.RegexFlag.is_integer(self, /)— Returns True. Exists for duck type compatibility with float.is_integer.RegexFlag.to_bytes(self, /, length=1, byteorder='big', *, signed=False)— Return an array of bytes representing an integer.
Usage
import re
flags = re.RegexFlag.IGNORECASE | re.RegexFlag.MULTILINE
assert re.search(r"^hello$", "line1\nHELLO", flags) is not None
Gotchas
IntFlagenum: Combine flags with|(bitwise OR), not+.- Short aliases exist on
re:re.I,re.M,re.S,re.X,re.Aare aliases for theRegexFlagmembers.
REPL Inspect
from re import RegexFlag
help(RegexFlag)
Linked from
Related notes
- tuts/python3/stdlib_module/re/purge Linked here; links to this page; shared tags: #re, #stdlib
- tuts/python3/stdlib_module/re/search Linked here; links to this page; shared tags: #re, #stdlib
- tuts/python3/stdlib_module/re Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/re/compile Linked here; shared tags: #re, #stdlib
- tuts/python3/stdlib_module/re/error Linked here; shared tags: #re, #stdlib
- tuts/python3/stdlib_module/re/escape Linked here; shared tags: #re, #stdlib
- tuts/python3/stdlib_module/re/findall Linked here; shared tags: #re, #stdlib
- tuts/python3/stdlib_module/re/finditer shared tags: #re, #stdlib
- tuts/python3/stdlib_module/re/fullmatch shared tags: #re, #stdlib
- tuts/python3/stdlib_module/re/match shared tags: #re, #stdlib