Compile a regular expression string in `regex`. If it contains newlines, use verbose mode.
(regex: str)
| 232 | |
| 233 | |
| 234 | def re_compile_maybe_verbose(regex: str) -> Pattern[str]: |
| 235 | """Compile a regular expression string in `regex`. |
| 236 | |
| 237 | If it contains newlines, use verbose mode. |
| 238 | """ |
| 239 | if "\n" in regex: |
| 240 | regex = "(?x)" + regex |
| 241 | compiled: Pattern[str] = re.compile(regex) |
| 242 | return compiled |
| 243 | |
| 244 | |
| 245 | def validate_regex( |
no outgoing calls
no test coverage detected