fork download
  1. import java.util.*;
  2. import java.util.regex.*;
  3.  
  4. class Ideone
  5. {
  6. public static void main (String[] args) throws java.lang.Exception
  7. {
  8. String texts[] = {"Abc <<", " ", "", "abc 123"};
  9. Pattern p = Pattern.compile("(?U)(?!\\s+\\z)[^<]+");
  10. for(String text : texts)
  11. {
  12. Matcher m = p.matcher(text);
  13. System.out.println("'" + text + "' => " + m.matches());
  14. }
  15. }
  16. }
Success #stdin #stdout 0.19s 50468KB
stdin
Standard input is empty
stdout
'Abc <<' => false
'     ' => false
'' => false
'abc 123' => true