Java tutorial
import java.util.regex.Pattern; import java.util.regex.Matcher; public class Main { private static final String REGEX = "[A-Z]+"; private static final String INPUT = "a:[AAAA|0.1;BBBBBBB|-1.90824;CC|0.0]"; public static void main(String[] args) { Pattern p = Pattern.compile(REGEX); // get a matcher object Matcher m = p.matcher(INPUT); List<String> sequences = new Vector<String>(); while (m.find()) { sequences.add(INPUT.substring(m.start(), m.end())); } } }