Indexerror: no such group python
<p>First of all: I'm feeling really dumb because I know this is a simple question with the answer right under my nose. I have looked answers everywhere but none seems to fit my question.</p>

<p>I am trying to fetch the number of an answer in a page using selenium.
This is what I have:</p>

<pre><code>if browser.find_elements_by_css_selector("tr.unreaded"):
print "There's messages unreaded!"
unread_answers = browser.find_elements_by_css_selector("tr.unreaded")
for unread_row in unread_answers:
    row_id = unread_row.get_attribute("id")
    m = re.search('answer_row_\d*', row_id)
    row_number = m.group(1)
    print row_number
</code></pre>

<p>This is the peace of HTML document I'm currently looking for:</p>

<pre><code>&lt;tr id="answer_row_3121238" class="bla bla bla"&gt;
...
&lt;tr id="answer_row_3121428" class="bla bla bla"&gt;
...
&lt;tr id="answer_row_3124238" class="bla bla bla"&gt;
</code></pre>

<p>I'm getting this error: <code>IndexError: no such group</code>.</p>

<p>I know there is resulted beeing fetched because I tried:</p>

<pre><code>if browser.find_elements_by_css_selector("tr.unreaded"):
print "There's messages unreaded!"
unread_answers = browser.find_elements_by_css_selector("tr.unreaded")
for unread_row in unread_answers:
    row_id = unread_row.get_attribute("id")
    m = re.search('answer_row_\d*', row_id)
    if m:
        print "Fetched results!"
    row_number = m.group(1)
    print row_number
</code></pre>

<p>The output was:
<code>Fetched results!</code></p>

<p><code>Fetched results!</code></p>

<p><code>Fetched results!</code></p>

<p>If I try to:</p>

<pre><code>print m
</code></pre>

<p>I get three objects beeing the output.</p>