# pydoc > sre_constants

---
type: CommandReference
command: sre_constants
mode: pydoc
section: ""
source: pydoc3
---

## Quick Reference

- `SRE_FLAG_*` — flag values for `re.compile()` (e.g., `SRE_FLAG_IGNORECASE=2`)
- `MAGIC = 20171005` — magic number for bytecode version
- `MAXGROUPS = 2147483647` — maximum group reference
- `FAILURE`, `SUCCESS` — opcodes for success/failure
- `AT_*` — position assertions (beginning, end, boundary, etc.)
- `CATEGORY_*` — character category constants (digit, space, word, etc.)
- `OPCODES` — list of all opcode constants
- `LITERAL`, `LITERAL_IGNORE`, `LITERAL_LOC_IGNORE`, `LITERAL_UNI_IGNORE` — literal match opcodes

## Name

Internal support module for sre — provides constants used by the `sre` regular expression engine.

## Constants

All constants are integers (or lists of integers) used internally by the `sre` module.

### Opcodes

- `FAILURE`, `SUCCESS`
- `ANY`, `ANY_ALL`
- `ASSERT`, `ASSERT_NOT`
- `AT`
- `BRANCH`, `CALL`, `CATEGORY`, `CHARSET`, `BIGCHARSET`
- `GROUPREF`, `GROUPREF_EXISTS`, `GROUPREF_IGNORE`, `GROUPREF_LOC_IGNORE`, `GROUPREF_UNI_IGNORE`
- `IN`, `IN_IGNORE`, `IN_LOC_IGNORE`, `IN_UNI_IGNORE`
- `INFO`, `JUMP`
- `LITERAL`, `LITERAL_IGNORE`, `LITERAL_LOC_IGNORE`, `LITERAL_UNI_IGNORE`
- `MARK`
- `MAX_REPEAT`, `MAX_UNTIL`, `MIN_REPEAT`, `MIN_REPEAT_ONE`, `MIN_UNTIL`
- `NEGATE`
- `NOT_LITERAL`, `NOT_LITERAL_IGNORE`, `NOT_LITERAL_LOC_IGNORE`, `NOT_LITERAL_UNI_IGNORE`
- `RANGE`, `RANGE_UNI_IGNORE`
- `REPEAT`, `REPEAT_ONE`
- `SUBPATTERN`

### Position Assertions (AT_*)

- `AT_BEGINNING`, `AT_BEGINNING_LINE`, `AT_BEGINNING_STRING`
- `AT_BOUNDARY`, `AT_NON_BOUNDARY`
- `AT_END`, `AT_END_LINE`, `AT_END_STRING`
- `AT_LOC_BOUNDARY`, `AT_LOC_NON_BOUNDARY`
- `AT_UNI_BOUNDARY`, `AT_UNI_NON_BOUNDARY`

### Character Category Constants (CATEGORY_*)

- `CATEGORY_DIGIT`, `CATEGORY_NOT_DIGIT`
- `CATEGORY_LINEBREAK`, `CATEGORY_NOT_LINEBREAK`
- `CATEGORY_SPACE`, `CATEGORY_NOT_SPACE`
- `CATEGORY_WORD`, `CATEGORY_NOT_WORD`
- `CATEGORY_LOC_WORD`, `CATEGORY_LOC_NOT_WORD`
- `CATEGORY_UNI_DIGIT`, `CATEGORY_UNI_NOT_DIGIT`
- `CATEGORY_UNI_LINEBREAK`, `CATEGORY_UNI_NOT_LINEBREAK`
- `CATEGORY_UNI_SPACE`, `CATEGORY_UNI_NOT_SPACE`
- `CATEGORY_UNI_WORD`, `CATEGORY_UNI_NOT_WORD`

### Flag Constants (SRE_FLAG_*)

- `SRE_FLAG_TEMPLATE = 1`
- `SRE_FLAG_IGNORECASE = 2`
- `SRE_FLAG_LOCALE = 4`
- `SRE_FLAG_MULTILINE = 8`
- `SRE_FLAG_DOTALL = 16`
- `SRE_FLAG_UNICODE = 32`
- `SRE_FLAG_VERBOSE = 64`
- `SRE_FLAG_DEBUG = 128`
- `SRE_FLAG_ASCII = 256`

### Info Constants (SRE_INFO_*)

- `SRE_INFO_PREFIX = 1`
- `SRE_INFO_LITERAL = 2`
- `SRE_INFO_CHARSET = 4`

### Other Constants

- `MAGIC = 20171005` — bytecode magic number
- `MAXGROUPS = 2147483647` — maximum number of groups
- `MAXREPEAT` — same as `MAX_REPEAT`
- `OPCODES` — list of all opcode constants
- `ATCODES` — list of all `AT_*` constants
- `CHCODES` — list of all `CATEGORY_*` constants
- `CH_LOCALE` — mapping from generic category to locale-specific category
- `CH_UNICODE` — mapping from generic category to Unicode-specific category
- `AT_LOCALE` — mapping from generic AT to locale-specific AT
- `AT_MULTILINE` — mapping from beginning/end to line-specific variants
- `AT_UNICODE` — mapping from generic AT to Unicode-specific AT
- `OP_IGNORE` — mapping from literal opcodes to case-insensitive variants
- `OP_LOCALE_IGNORE` — mapping from literal opcodes to locale-aware case-insensitive variants
- `OP_UNICODE_IGNORE` — mapping from literal opcodes to Unicode-aware case-insensitive variants

## See Also

- [sre_constants module documentation](https://docs.python.org/3.10/library/sre_constants.html)
- `re` module — high-level regular expression API
- `sre_compile` — internal compiler module
- `sre_parse` — internal parser module