implemented regex matching