
// student file

import java.io.FileReader;
import java.io.BufferedReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.StringTokenizer;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
import java.util.Arrays;

public class regex7 
{   
    FileReader reader;
    FileWriter writer;
    BufferedReader in;
    String regex;
    Pattern pattern;
    Matcher matcher;
    String result;
        
    public regex7() throws IOException
    {   reader = new FileReader("H:LookBehind.txt");
        writer = new FileWriter("H:LookBehind.out");
        in = new BufferedReader(reader);
        String line, word, result = "";
		
		// TO DO: enter the regex pattern
        regex = " ";
 
        pattern = Pattern.compile(regex);

		// TO DO: As before, declare an array of Strings.  Set up a loop that reads 1 line at a time
		// from LookBehind.txt.  Use .split(" ") to separate the words and assign them to the array.
		// Set up an inner loop that steps through each word ('word') in the array and see if it
		// matches the regex pattern.  Print the resulting words to LookBehind.out.
      
	  
	  
                    matcher = pattern.matcher(word);
                    if (matcher.find())
                    {   result = matcher.group(); 
                        
						
                    }
                }
            }
        }
        writer.close();
    }
    
    public static void main(String[] args) throws IOException
    {
        regex7 hm2 = new regex7();
    }
}
