Advertisement
Guest User

Regex

a guest
Mar 31st, 2015
307
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.54 KB | None | 0 0
  1.     private static List<String> getArray() throws IOException {
  2.         return Files.readAllLines(Paths.get("TimeTable.csv"));
  3.     }
  4.  
  5.     public static void main(String[] args) throws IOException {
  6.  
  7.         String p = "(?i)^\"(\\w+) (\\w+) (\\w+) (?:.+)?\",\"(\\d+)\\.(\\d+)\\.(\\d+)\",\"(\\d+):(\\d+):(\\d+)\"(?:.*?)$";
  8.         String rep = "$6-$5-$4 ==> $7:$8 $1 $2 $3";
  9.         List<String> res = getArray();
  10.         for(int i = 1; i < res.size(); ++i) {
  11.             System.out.println(res.get(i).replaceAll(p, rep));
  12.         }
  13.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement