# coding=utf8
# the above tag defines encoding for this document and is for Python 2.x compatibility
import re
regex = r",(?=\R|\z)"
test_str = ("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),")
subst = ""
# You can manually specify the number of replacements by changing the 4th argument
result = re.sub(regex, subst, test_str, 0, re.MULTILINE)
if result:
print (result)
# Note: for Python 2.7 compatibility, use ur"" to prefix the regex and u"" to prefix the test string and substitution.
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 Python, please visit: https://docs.python.org/3/library/re.html