fork(2) download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4.  
  5. class Ideone
  6. {
  7. public static void main (String[] args) throws java.lang.Exception
  8. {
  9. String block = "somelongpattern[0-9]";
  10. String final_regex = String.format("^(%1$s)([,; ]+%1$s)*$",block);
  11. System.out.println(final_regex);
  12. }
  13. }
Success #stdin #stdout 0.06s 27980KB
stdin
Standard input is empty
stdout
^(somelongpattern[0-9])([,; ]+somelongpattern[0-9])*$