title: Applying a Regex to a Substring Without using String Slice
body: <p>I want to search for a regex match in a larger string <strong>from a certain position onwards</strong>, and <strong>without using string slices</strong>.</p>
  
  <p>My background is that I want to search through a string iteratively for matches of various regex's. A natural solution in Python would be keeping track of the current position within the string and using e.g. </p>
  
  <pre><code>re.match(regex, largeString[pos:])
  </code></pre>
  
  <p>in a loop. But for really large strings (~ 1MB) string slicing as in <code>largeString[pos:]</code> becomes expensive. I'm looking for a way to get around that.</p>
  
  <p>Side note: Funnily, in a niche of the <a href="http://docs.python.org/library/re.html#matching-vs-searching" rel="nofollow">Python documentation</a>, it talks about an optional <code>pos</code> parameter to the match function (which would be exactly what I want), which is not to be found with the functions themselves :-).</p>