[Tutor] re.search() help

Michael Lewis mjolewis at gmail.com
Sun Apr 15 09:10:35 CEST 2012


Hi everyone,

I am a bit confused on how one would ever use re.search(). It essentially
tells me the location on (RAM?) if the pattern matches? What is the purpose
of this? Can you give me a good example of where it would be useful?

Thanks!

re.search(*pattern*, *string*,
*flags=0*)<http://docs.python.org/library/re.html#re.search>

Scan through *string* looking for a location where the regular expression *
pattern* produces a match, and return a corresponding
MatchObject<http://docs.python.org/library/re.html#re.MatchObject>
instance.
Return None if no position in the string matches the pattern; note that
this is different from finding a zero-length match at some point in the
string.

-- 
Michael J. Lewis
mjolewis at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120415/632eb9be/attachment.html>


More information about the Tutor mailing list