A flag is just an int. From the re doc, you can see
there is a ignorecase flag:
"
I
IGNORECASE
Perform case-insensitive matching; expressions like [A-Z] will
match lowercase letters, too. This is not affected by the current locale.
"
Using the ignorecase flag:
>>> import re
>>> print re.I
2
>
Xah Lee wrote:
> Python re module has methods flags and pattern. How to use these
> exactly?
>From the Python 2.3 documentation, section 2.4.2
flags
The flags argument used when the RE object was compiled, or 0 if no
flags were provided.
groupindex
A dictionary mapping any symbolic group name
Xah Lee wrote:
> Python re module has methods flags and pattern. How to use these
> exactly?
>
> e.g. i tried
>
> print patternObj.flags()
>
> and the error is some "int object is not callable".
Where do you read "methods"?
Reinhold
--
http://mail.python.org/mailman/listinfo/python-list
Python re module has methods flags and pattern. How to use these
exactly?
e.g. i tried
print patternObj.flags()
and the error is some "int object is not callable".
newpattern=re.compile(ur'\w+',patternObj.flags())
also bad.
similar error for patternObj.pattern(). (and i suppose the same for
g