You should include a check here for the case where no text is found.  I've been following the convention:

* If nothing found, print a warning (`self.warning(msg)`) and return something sensible (maybe `None` in this case)?
* If multiple items found, use the first one.  If this seems likely to occur, then also print a warning message.