Compilation flags
When compiling a pattern string into a pattern object, it's possible to modify the standard behavior of the patterns. In order to do that, we have to use the compilation flags. These can be combined using the bitwise OR "|
".
Flag |
Python |
Description |
---|---|---|
|
2.x 3.x |
The pattern will match lower case and upper case. |
|
2.x 3.x |
This flag changes the behavior of two metacharacters:
|
|
2.x 3.x |
The metacharacter " |
Get Mastering Python Regular Expressions now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.