regular expression - matches
Tim Chase
python.list at tim.thechases.com
Fri Jul 21 09:48:24 EDT 2006
abcd wrote:
> how can i determine if a given character sequence matches my regex,
> completely?
>
> in java for example I can do,
> Pattern.compile(regex).matcher(input).matches()
>
> this returns True/False whether or not input matches the regex
> completely.
>
> is there a matches in python?
>>> import re
>>> 'match' in dir(re)
True
>>> help(re.match)
Help on function match in module sre:
match(pattern, string, flags=0)
Try to apply the pattern at the start of the string, returning
a match object, or None if no match was found.
For more info, see
http://docs.python.org/lib/module-re.html
-tkc
More information about the Python-list
mailing list