<div dir="ltr">Hi everyone,<div><br></div><div>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?</div>

<div><br></div><div>Thanks!</div><div><br></div><div><dt id="re.search" style="font-family:sans-serif;font-size:16px;background-color:rgb(255,255,255)"><tt class="descclassname" style="background-color:transparent;padding-top:0px;padding-right:1px;padding-bottom:0px;padding-left:1px;font-size:0.95em">re.</tt><tt class="descname" style="background-color:transparent;padding-top:0px;padding-right:1px;padding-bottom:0px;padding-left:1px;font-size:1.2em;font-weight:bold">search</tt><big>(</big><em>pattern</em>, <em>string</em>, <em>flags=0</em><big>)</big><a class="headerlink" href="http://docs.python.org/library/re.html#re.search" title="Permalink to this definition" style="color:rgb(198,15,15);text-decoration:none;font-size:0.8em;padding-top:0px;padding-right:4px;padding-bottom:0px;padding-left:4px"></a></dt>

<dd style="margin-top:3px;margin-bottom:10px;margin-left:30px;text-align:justify;line-height:20px;font-family:sans-serif;font-size:16px;background-color:rgb(255,255,255)"><p style="margin-top:0px">Scan through <em>string</em> looking for a location where the regular expression <em>pattern</em> produces a match, and return a corresponding <a class="reference internal" href="http://docs.python.org/library/re.html#re.MatchObject" title="re.MatchObject" style="color:rgb(53,95,124);text-decoration:none"><tt class="xref py py-class docutils literal" style="background-color:transparent;padding-top:0px;padding-right:1px;padding-bottom:0px;padding-left:1px;font-size:0.95em;font-weight:bold"><span class="pre">MatchObject</span></tt></a> instance. Return <tt class="xref docutils literal" style="background-color:transparent;padding-top:0px;padding-right:1px;padding-bottom:0px;padding-left:1px;font-size:0.95em;font-weight:bold"><span class="pre">None</span></tt> 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.</p>

</dd><div><br></div>-- <br><div dir="ltr"><div>Michael J. Lewis</div>
<div><a href="mailto:mjolewis@gmail.com" target="_blank">mjolewis@gmail.com</a></div></div><br>
</div></div>