import java.util.*;
import java.lang.*;
import java.io.*;
class Ideone
{
{
String block
= "somelongpattern[0-9]"; String final_regex
= String.
format("^(%1$s)([,; ]+%1$s)*$",block
); System.
out.
println(final_regex
); }
}
aW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgpjbGFzcyBJZGVvbmUKewoJcHVibGljIHN0YXRpYyB2b2lkIG1haW4gKFN0cmluZ1tdIGFyZ3MpIHRocm93cyBqYXZhLmxhbmcuRXhjZXB0aW9uCgl7CgkJU3RyaW5nIGJsb2NrID0gInNvbWVsb25ncGF0dGVyblswLTldIjsKCQlTdHJpbmcgZmluYWxfcmVnZXggPSBTdHJpbmcuZm9ybWF0KCJeKCUxJHMpKFssOyBdKyUxJHMpKiQiLGJsb2NrKTsKCQlTeXN0ZW0ub3V0LnByaW50bG4oZmluYWxfcmVnZXgpOwoJfQp9