def _vdoms_path_exp(path_exp, vdom=None):
    """
    :param path_exp: JMESPath expression for search results
    :param vdom: Specify vdom to search for

    :return: A JMESPath expression to search results

    >>> _vdoms_path_exp("configs[?config=='system global']")
    "configs[?config=='vdom'].edits[].configs[?config=='system global'][]"
    >>> _vdoms_path_exp("configs[]", vdom="root")
    "configs[?config=='vdom' && edits[0].edit=='root'].edits[].configs[]"
    """
    if vdom:
        return ("configs[?config=='vdom' && edits[0].edit=='{}']"
                ".edits[].".format(vdom) + path_exp)

    return "configs[?config=='vdom'].edits[]." + path_exp + "[]"