import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class HelloRegex {
	public static void main(String...args) {
		System.out.println("Hello Regex!");
		
		findIt("foo", "foo");
		findIt("foo", "foofoofoo");
		
		findIt("cat.", "cats");
		
		findIt("[bcr]at", "bat");
		findIt("[bcr]at", "cat");
		findIt("[bcr]at", "rat");
		findIt("[bcr]at", "hat");
		
		findIt("[^bcr]at", "bat");
		findIt("[^bcr]at", "cat");
		findIt("[^bcr]at", "rat");
		findIt("[^bcr]at", "hat");
		
		findIt("[a-c]", "a");
		findIt("[a-c]", "b");
		findIt("[a-c]", "c");
		findIt("[a-c]", "d");

	}
	
	static void findIt(String regexString, String stringToSearch) {
		Pattern pattern = Pattern.compile(regexString);
		Matcher matcher = pattern.matcher(stringToSearch);
		boolean found = false;
		while (matcher.find()) {
			System.out.printf("I found the text" +
                    " \"%s\" starting at " +
                    "index %d and ending at index %d.%n",
                    matcher.group(),
                    matcher.start(),
                    matcher.end());
			found = true;
		} 
		if (!found){
			System.out.printf("No match for regexString<%s> stringToSearch<%s>\n", regexString, stringToSearch);
		}
	}
}

@@ -84,17 +84,20 @@
 Regex %7B%0A
-%09
+    
 public s
@@ -125,16 +125,17 @@
 g...
+ 
 args) %7B%0A
 %09%09Sy
@@ -130,18 +130,24 @@
 args) %7B%0A
-%09%09
+        
 System.o
@@ -170,29 +170,33 @@
 o Regex!%22);%0A
-%09%09%0A%09%09
+%0A        
 findIt(%22foo%22
@@ -201,26 +201,32 @@
 o%22, %22foo%22);%0A
-%09%09
+        
 findIt(%22foo%22
@@ -237,29 +237,33 @@
 oofoofoo%22);%0A
-%09%09%0A%09%09
+%0A        
 findIt(%22cat.
@@ -270,29 +270,33 @@
 %22, %22cats%22);%0A
-%09%09%0A%09%09
+%0A        
 findIt(%22%5Bbcr
@@ -301,34 +301,40 @@
 cr%5Dat%22, %22bat%22);%0A
-%09%09
+        
 findIt(%22%5Bbcr%5Dat%22
@@ -335,34 +335,40 @@
 cr%5Dat%22, %22cat%22);%0A
-%09%09
+        
 findIt(%22%5Bbcr%5Dat%22
@@ -369,34 +369,40 @@
 cr%5Dat%22, %22rat%22);%0A
-%09%09
+        
 findIt(%22%5Bbcr%5Dat%22
@@ -403,37 +403,41 @@
 cr%5Dat%22, %22hat%22);%0A
-%09%09%0A%09%09
+%0A        
 findIt(%22%5B%5Ebcr%5Dat
@@ -443,26 +443,32 @@
 t%22, %22bat%22);%0A
-%09%09
+        
 findIt(%22%5B%5Ebc
@@ -478,26 +478,32 @@
 t%22, %22cat%22);%0A
-%09%09
+        
 findIt(%22%5B%5Ebc
@@ -513,26 +513,32 @@
 t%22, %22rat%22);%0A
-%09%09
+        
 findIt(%22%5B%5Ebc
@@ -556,13 +556,17 @@
 %22);%0A
-%09%09%0A%09%09
+%0A        
 find
@@ -579,26 +579,32 @@
 -c%5D%22, %22a%22);%0A
-%09%09
+        
 findIt(%22%5Ba-c
@@ -609,26 +609,32 @@
 -c%5D%22, %22b%22);%0A
-%09%09
+        
 findIt(%22%5Ba-c
@@ -643,18 +643,24 @@
 , %22c%22);%0A
-%09%09
+        
 findIt(%22
@@ -677,15 +677,20 @@
 %22);%0A
-%0A%09%7D%0A%09%0A%09
+    %7D%0A %0A    
 stat
@@ -749,18 +749,24 @@
 arch) %7B%0A
-%09%09
+        
 Pattern 
@@ -805,18 +805,24 @@
 tring);%0A
-%09%09
+        
 Matcher 
@@ -864,18 +864,24 @@
 earch);%0A
-%09%09
+        
 boolean 
@@ -895,18 +895,24 @@
  false;%0A
-%09%09
+        
 while (m
@@ -928,19 +928,28 @@
 nd()) %7B%0A
-%09%09%09
+            
 System.o
@@ -978,36 +978,16 @@
  text%22 +
-%0A                   
  %22 %5C%22%25s%5C
@@ -1006,13 +1006,9 @@
 t %22 
-+%0A   
+%0A
     
@@ -1019,16 +1019,17 @@
         
++
  %22index 
@@ -1067,36 +1067,32 @@
                 
-    
 matcher.group(),
@@ -1095,65 +1095,25 @@
 p(),
-%0A                    matcher.start(),%0A                   
+ matcher.start(),
  mat
@@ -1125,19 +1125,28 @@
 end());%0A
-%09%09%09
+            
 found = 
@@ -1155,15 +1155,26 @@
 ue;%0A
-%09%09%7D %0A%09%09
+        %7D%0A        
 if (
@@ -1184,13 +1184,23 @@
 und)
+ 
 %7B%0A
-%09%09%09
+            
 Syst
@@ -1266,16 +1266,33 @@
 %25s%3E%5Cn%22, 
+%0A                
 regexStr
@@ -1317,13 +1317,22 @@
 h);%0A
-%09%09%7D%0A%09
+        %7D%0A    
 %7D%0A%7D%0A

Update HelloRegex.java