import java.util.*;
import java.util.regex.*;

class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		String texts[]  = {"Abc <<", "     ", "", "abc 123"};
		Pattern p = Pattern.compile("(?U)(?!\\s+\\z)[^<]+");
	    for(String text : texts)
	    {
	    	Matcher m = p.matcher(text);
	        System.out.println("'" + text + "' => " + m.matches());
	    }
	}
}