fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main(String[] args) {
  11. String abcd = "A|14|23|656\r\nB|15|ga|a\r\nA|11|424|6262";
  12.  
  13. try (final Scanner scan = new Scanner(abcd)) {
  14. scan.useDelimiter("(?m)^A\\|");
  15. while (scan.hasNext()) {
  16. System.out.println("Group");
  17. System.out.println("A|" + scan.next());
  18. }
  19. }
  20. }
  21. }
Success #stdin #stdout 0.07s 4386816KB
stdin
Standard input is empty
stdout
Group
A|14|23|656
B|15|ga|a

Group
A|11|424|6262