title: Python regex: 'exceptions.IndexError: string index out of range'
body: <p>I am using a simple regex to replace instances of strings in the format 'id="111111". These strings are derived as part of a webpage response generated using scrapy and filtered using another regex to give me only the output I want. I'm using re.sub in the following fashion:</p>
  
  <pre><code>match3 = re.sub("/id="[0-9]+"/", ' ', match3)
  </code></pre>
  
  <p>However, this is throwing up the following error:</p>
  
  <pre><code>exceptions.IndexError: string index out of range
  </code></pre>
  
  <p>Can anyone explain to me what the issue is here?</p>
  
  <p>Thanks</p>