def is_read_pair(rec1, rec2, casava18=True):
    """Returns true if the two records belong to the same read pair, determined by matching the header strings and disregarding
       the read field
    """
    # Handle pre-casava1.8 headers
    if not casava18:
        return (rec1[0][0:-1] == rec2[0][0:-1])
    
    r1 = rec1[0].split(' ')
    r2 = rec2[0].split(' ')
    return (len(r1) == 2 and len(r2) == 2 and r1[0] == r2[0] and r1[1][1:] == r2[1][1:])