const MAX_REGEX_SIZE_BEFORE_COMPILATION: usize = _; // 1_048_576usizeExpand description
We also need a separate limit for the size of regexes before compilation. Even though the
Regex crate promises that using its size_limit option (which we set to the other limit,
MAX_REGEX_SIZE_AFTER_COMPILATION) would prevent excessive resource usage, this doesn’t seem to
be the case. Since we compile regexes in envd, we need strict limits to prevent envd OOMs.
See https://github.com/MaterializeInc/database-issues/issues/9907 for an example.
This bounds the AST’s node count, since every node needs at least one pattern byte, and with it
every node kind whose cost is bounded. Character classes are not, hence
MAX_REGEX_CHARACTER_CLASSES.
Note: This number is mentioned in our user-facing docs at the “String operators” in the function reference.