import re


def txt2doi(txt):
    """
    Extract a DOI from text data
    """
    regex_arr = [
        r'(https?://)?dx\.doi\.org/([0-9.]+/[A-Za-z0-9.]+)',
        r'(DOI|doi):([0-9.]+/[A-Za-z0-9.]+)'
    ]
    for regex in regex_arr:
        m = re.search(regex, txt)
        if m is not None:
            return m.group(0), m.group(2)
    return None, None