Build regex patterns with explanations and test cases