@@ -0,0 +1,1346 @@
+package thirty_days_of_code;%0D%0A%0D%0Aimport java.util.regex.*;%0D%0Aimport java.util.Scanner;%0D%0A%0D%0A/* Problem Statement:%0D%0A * RegEx helps us easily search for or match a Pattern in text. Before searching%0D%0A * for a Pattern, we must specify it using some well-defined syntax.%0D%0A * %0D%0A * Given a string, determine if it's a valid Pattern or not. The string may%0D%0A * contain spaces.%0D%0A * %0D%0A * Input Format: %0D%0A * The first line of input contains an integer, T (the number of test cases).%0D%0A * The T subsequent lines of test cases each contain a string of characters%0D%0A * describing a RegEx.%0D%0A * %0D%0A * Constraints:%0D%0A * 1 %3C= T %3C= 100%0D%0A * %0D%0A * Output Format: %0D%0A * On a new line for each test case, print Valid if the given RegEx's syntax is%0D%0A * correct; otherwise, print Invalid.%0D%0A * %0D%0A * Sample Input: %0D%0A * 3%0D%0A * (%5BA-Z%5D)(.+)%0D%0A * %5BAZ%5Ba-z%5D(a-z)%0D%0A * batcatpat(nat%0D%0A * %0D%0A * Sample Output: %0D%0A * Valid%0D%0A * Invalid%0D%0A * Invalid%0D%0A */%0D%0Apublic class RegexPatternsIntroToDatabases %7B%0D%0A%0D%0A%09public static void main(String%5B%5D args) %7B%0D%0A%09%09Scanner in = new Scanner(System.in);%0D%0A%09%09int testCases = Integer.parseInt(in.nextLine());%0D%0A%09%09while (testCases %3E 0) %7B%0D%0A%09%09%09String pattern = in.nextLine();%0D%0A%09%09%09try %7B%0D%0A%09%09%09%09Pattern.compile(pattern);%0D%0A%09%09%09%09System.out.println(%22Valid%22);%0D%0A%09%09%09%7D catch (PatternSyntaxException e) %7B%0D%0A%09%09%09%09System.out.println(%22Invalid%22);%0D%0A%09%09%09%7D%0D%0A%09%09%09testCases--;%0D%0A%09%09%7D%0D%0A%09%09in.close();%0D%0A%09%7D%0D%0A%7D

Add RegexPatternsIntroToDatabases