Backport matches_filter