Python Regex Search For HTML Tag with UUID : I'm trying to match a single html whole tag with an id attribute which is a UUID.  I tested it with an external resource to make sure the regex is correct with the same input string. The UUID is extracted dynamically so the string replacement is necessary. The output I get when printing is the whole input string which would suggest the regex is incorrect. What's going on here?

The output I would would expect is for the last line to print:

    <tr class="ref_row" id="b9060ff1-015d-4089-a193-8fef57e7c2ef">

This is the code I tried:

                content = '<tbody><tr class="ref_row" id="b9060ff1-015d-4089-a193-8fef57e7c2ef"><td><b>01/08/2016 14:41:00</b></td>'
                ref = 'b9060ff1-015d-4089-a193-8fef57e7c2ef'
                regex = '<[^>]+?id=\"%s\"[^<]*?>' % ref
                regex_comp = re.compile(regex)
                element_to_link = regex_comp.search(content)
                print element_to_link.string

I also tried:
   
      element_to_link = re.search(regex, content)

Which yielded the same result.

Please don't suggest that I use Beautiful Soup, this should be possible to do with regular expressions.

Thank you for taking the time to read my question