I don’t know why I can’t modify the question, so I’ll add an answer of my own and then synthesize the adopted answers.
The documentation of the
flags参数在re module is described like this:
Values can be any of the following variables, combined using bitwise OR (the | operator).
These constants can be used simultaneously using the bit or the operator. The default value is 0, which means no flag constants are used, which makes sense. for example
As shown in the source code, if
is not a string, then there is no compilation step, so these parameters will naturally be ignored. regex
I have never used this library, but I will answer according to my own understanding of re. This should encapsulate some regular functions
1. Reference https://docs.python.org/2/library/re.html#re.compile
flags: View specific flag constants
2. What he means is that the value type passed in regex is not string, ignore it
update:
Download the library and see the source code at a glance:
First determine whether the incoming regx is a string, and then compile
I don’t know why I can’t modify the question, so I’ll add an answer of my own and then synthesize the adopted answers.
The documentation of theflags
参数在re
module is described like this:These constants can be used simultaneously using the bit or the operator. The default value is 0, which means no flag constants are used, which makes sense.
for example
is not a string, then there is no compilation step, so these parameters will naturally be ignored.
regex