def create_url_regex(url_name, trail_num=None):
    """
    Used to create the API
    :param url_name: The origin url name
    :param trail_num: Number of trails URL to disregard: (XXX/XXX/XXX)
    :return:
    """
    url = '/' + url_name
    if trail_num:
        for i in range(trail_num):
            url += '/([%&+ \\w]+)'
    return url + '.*'
