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