Recursive matching