fork download
  1. import java.util.*;
  2. import java.util.regex.*;
  3. import java.lang.*;
  4. import java.io.*;
  5. class Ideone
  6. {
  7. public static void main (String[] args) throws java.lang.Exception
  8. {
  9. String[] arrayOfLine = {"2017 ." , "." , "$30","AVAILABLE.”"};
  10. Pattern pat = Pattern.compile("^[A-Z]+\\.[0-9]+\\b");
  11. List<String> listOfHeadings = new ArrayList<>();
  12. for (String s : arrayOfLine) {
  13. Matcher m = pat.matcher(s);
  14. if (m.find()) {
  15. listOfHeadings.add(s);
  16. }
  17. }
  18. System.out.println(listOfHeadings);
  19.  
  20. }
  21. }
Success #stdin #stdout 0.04s 4386816KB
stdin
Standard input is empty
stdout
[]