def join_patterns(pattern1, pattern2):
    """
    Joins URL patterns
    """
    if pattern1.endswith('$'):
        return pattern1
    try:
        if pattern2.startswith('^'):
            return pattern1 + pattern2[1:]
        if pattern2:
            return pattern1 + '.' + pattern2
    except AttributeError:
        if str(pattern2).startswith('^'):
            return pattern1 + str(pattern2)[1:]
        if pattern2:
            return pattern1 + '.' + str(pattern2)
    return pattern1
