import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Example {
public static void main(String[] args) {
final String regex = ",(?=\\R|\\z)";
final String string = "Module Statements,Module,Collection of primitive building blocks and instances of other modules that comprise a network and or instrument. Two types handoff or internal,A redefinition of a module_def shall overwrite a previously defined module_def having the same module_name within the same nameSpace_name.,6.4.5.a),\n"
+ "Module Statements,,,A module_def shall have at least one port_def unless it is the top module and contains an AccessLink statement,6.4.5.b),\n"
+ "Module Statements,,,\"The following objects shall have unique names within a module_def: port_name ? scanRegister_name ? dataRegister_name ? one_hot_scan_group_name ? scanMux_name ? dataMux_name ? clockMux_name ? one_hot_data_group_name ? logicSignal_name ? alias_name\",6.4.5.c),\n"
+ "Module Statements,,,\"The following objects shall have unique names within a module_def: instance_name ? scanInterface_name\",6.4.5.d),\n"
+ "Module Statements,,,\"An inputPort_name shall be one of the following scanInPort_name ? shiftEnPort_name ? captureEnPort_name ? updateEnPort_name ? dataInPort_name ? selectPort_name ? resetPort_name ? tmsPort_name ? tckPort_name ? clockPort_name ? trstPort_name ? addressPort_name ? writeEnPort_name ? readEnPort_name \",6.4.5.e),\n"
+ "Module Statements,,,\"An outputPort_name shall be one of the following: ? scanOutPort_name ? dataOutPort_name ? toShiftEnPort_name ? toUpdateEnPort_name ? toCaptureEnPort_name ? toSelectPort_name ? toResetPort_name ? toTckPort_name ? toTmsPort_name ? toClockPort_name ? toTrstPort_name ? toIRSelectPort_name\",6.4.5.f),\n"
+ "Module Statements,,,Multiple inputPort_name port functions that are of type vector_id may share the same SCALAR_ID as long as the indexes form a contiguous range and every index range is of the same either ascending or descending type.,6.4.5.g),\n"
+ "Module Statements,,,Multiple outputPort_name port functions that are of type vector_id may share the same SCALAR_ID as long as the indexes form a contiguous range and every index range is of the same either ascending or descending type.,6.4.5.h),";
final String subst = "";
final Pattern pattern = Pattern.compile(regex, Pattern.MULTILINE);
final Matcher matcher = pattern.matcher(string);
// The substituted value will be contained in the result variable
final String result = matcher.replaceAll(subst);
System.out.println("Substitution result: " + result);
}
}
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