@@ -0,0 +1,3203 @@
+/*%0A * To change this license header, choose License Headers in Project Properties.%0A * To change this template file, choose Tools %7C Templates%0A * and open the template in the editor.%0A */%0Apackage focus;%0A%0A/**%0A *%0A * @author rakesh%0A */%0A%0A%0A%0Apublic class RegexGenerate %7B%0A    %0A        String train_set; //Store first training set in variable to compare it with other training sets char by char%0A        StringBuilder regex=new StringBuilder();%0A        String escapeChars=%22%5C%5C$.*+?%7B%7D%7C%5B%5D()%5E%22;   // Characters that needs to be escaped before generating regex%0A        int count=0; // count for keeping count of  training sets%0A%0A       %0A    private void generateRegex(String%5B%5D training_set) // * Works only for two training sets * %0A    %7B%0A                //Scan URL's char by char and Generate Regex%0A        %0A        for(int i=0;i%3Ctraining_set%5B0%5D.length();i++)  //loop all characters%0A        %7B   %0A            count=0; //reset counter%0A            %0A            for(int j=0;j%3Ctraining_set.length;j++) //loop all training sets%0A            %7B%0A            if(train_set.charAt(i)==training_set%5Bj%5D.charAt(i))    //compare first training set with others char by char%0A                %7B%0A                    count=count+1;  // increment counter ; it acts as flag to indicate either a perticular char from all training sets is same or not%0A                %7D%0A            %7D       %0A            %0A%0A            if(count==training_set.length) // if char from all traaining sets is same%0A            %7B%0A               // System.out.println(%22Hell%22);%0A                    if(escapeChars.contains(String.valueOf(train_set.charAt(i))))%7B  //Escape chars %0A                        regex.append(%22%5C%5C%22+train_set.charAt(i));  // Escape the char%0A                        continue;%0A                        %0A                    %7D%0A                    else if(%221234567890%22.contains(String.valueOf(train_set.charAt(i)))) %7B  // digits regex keyword %5Bprobably to avoid bugs%5D%0A                        regex.append(%22%5C%5Cd%22);%0A                        continue;%0A                    %7D%0A                    //System.out.println(%22Matched %22+train_set.charAt(j));%0A                    regex.append(train_set.charAt(i));%0A            %0A            %7D%0A%0A            else%0A            %7B%0A                  //System.out.println(%22Bell%22);%0A%0A               // if(%221234567890%22.contains(String.valueOf(train_set.charAt(i))))   // digits regex keyword %5Bprobably to avoid bugs%5D%0A                 //       regex.append(%22%5C%5Cd%22);%0A                //else%0A                    regex.append(%22.%22);%0A            %7D%0A            %0A        %7D%0A        %0A    %7D%0A    %0A    //Length of all training sets must be same%0A    %0A    public  RegexGenerate(String%5B%5D training_set)%0A    %7B%0A        train_set=training_set%5B0%5D;%0A        generateRegex(training_set);%0A        System.out.println(%22Generated Regex  : %22+regex.toString());%0A    %7D%0A    /**%0A     * @param args the command line arguments%0A     */%0A    public static void main(String%5B%5D args) %7B%0A        // TODO code application logic here%0A        String%5B%5D arr=%7B%22thread.php?thread_id=12l1%22,%22thread.php?thread_id=2233%22,%22thraad.php?thread_id=2333%22%7D; //only two training sets should be provided & length should be same for both tarinig sets%0A        new RegexGenerate(arr);%0A        %0A    %7D%0A    %0A%7D%0A%0A

Create RegexGenerate.java