import re


def check_name_in_url(name, url):
    """
    Sample: for the name of "Bai Li", \
    www.xx.com/li.jpg get 0.5
    www.xx.org/bai_li.jpg get 1
    www.xx.org.avatar.jpg get 0
    """
    score = 0
    for i in re.split(r'[ -]', name):
        if i.lower() in url.lower():
            score += 1
    return score / len(name.split(' '))