from typing import Union


def find_docid_hal(x: str) -> Union[None, str]:
    """Find the docid from input string."""
    try:
        for w in x.split(' '):
            if 'docid_hal_' in w:
                return w.split('_')[2].split(';')[0]
        return None
    except Exception:
        return None