import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Example {
public static void main(String[] args) {
final String regex = "^_.*(*SKIP)(*F)|\\[\\[|]]";
final String string = "## [[zoom]] _[v]_\n\n"
+ ">[[move]] | [[very]] | [[quickly]]\n\n"
+ "__Synonyms__: [[buzz]] | [[dart]] | [[dash]] | [[dive]] | [[flash]] | [[fly]] | [[hum]] | [[hurtle]] | outstrip | [[rip]] | [[rocket]] | [[rush]] | [[shoot]] | [[shoot]] up | [[skyrocket]] | [[speed]] | [[streak]] | [[surge]] | [[tear]] | [[whirl]] | [[whiz]] | [[zip]]\n\n"
+ "__Concepts__: [[ACTIONS - MOTION#move oneself quickly (150)\\|move oneself quickly]] \n\n"
+ "__Antonyms__: decelerate, [[slow]]\n\n"
+ "## [[zip]] _[n]_\n\n"
+ ">[[enthusiasm]], [[energy]]\n\n"
+ "__Synonyms__: brio | [[drive]] | [[get]]-upand-[[go]] | [[go]] | [[gusto]] | [[life]] | liveliness | [[oomph]] | [[pep]] | [[pizzazz]] | [[punch]] | [[sparkle]] | [[spirit]] | [[verve]] | [[vigor]] | vim | [[vitality]] | [[zest]] | [[zing]]\n\n"
+ "__Concepts__: [[LIFE FORMS - GENERAL CHARACTERISTICS#personality (411)\\|personality]], [[STATES - ABSTRACT#behavior (633)\\|behavior]] \n\n"
+ "__Antonyms__: [[apathy]], enervation, [[idleness]], [[laziness]], [[lethargy]]\n"
+ " \n"
+ "## [[zip]] _[v]_\n\n"
+ ">[[move]] | [[about]] | [[quickly]]\n\n"
+ "__Synonyms__: [[bustle]] | [[dash]] | [[flash]] | [[fly]] | [[hasten]] | [[hurry]] | [[run]] | [[rush]] | [[shoot]] | [[speed]] | [[tear]] | waltz | [[whisk]] | [[whiz]] | [[zoom]]\n\n"
+ "__Concepts__: [[ACTIONS - MOTION#move oneself quickly (150)\\|move oneself quickly]] \n\n"
+ "__Antonyms__: decelerate, [[slow]]";
final Pattern pattern = Pattern.compile(regex, Pattern.MULTILINE);
final Matcher matcher = pattern.matcher(string);
while (matcher.find()) {
System.out.println("Full match: " + matcher.group(0));
for (int i = 1; i <= matcher.groupCount(); i++) {
System.out.println("Group " + i + ": " + matcher.group(i));
}
}
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Java, please visit: https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html