/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		String frontPage = "<html>\n<head>\n<title>Hello</title>\n</head>\n" + 
            "<body>\n<table>\n<tr align=\"left\">\n" + 
            "<td>Hello \n<form>\n<input type=\"submit\" value=\"ok\">\n" + 
            "</form>\n</td>\n" + 
            "<td>World \n<form>\n<input type=\"submit\" value=\"ok\">\n" + 
            "</form>\n</td>\n" + 
            "</tr>\n</table>\n</body>\n</html>";

		java.util.regex.Pattern p =
                java.util.regex.Pattern.compile(
					"(align=\"left\">\\n)(?<part>.*?)(<\\/form>\\n<\\/td>)",
					java.util.regex.Pattern.DOTALL
					);
				java.util.regex.Matcher m = p.matcher(frontPage);

		List<String> parts = new ArrayList<>();
		while (m.find()) {
			System.out.println("Match: " + m.group("part") + "\n"); 
		}
	}
}