# coding=utf8
# the above tag defines encoding for this document and is for Python 2.x compatibility
import re
regex = r"(?sm)^-(?:(?!^-\r?$).)*?^:86:(?!/..../)(?:(?!^-\r?$).)*"
test_str = ("-\n"
":20:296535/00000010\n"
":21:ABNADK2AXXX\n"
":25:ABNADK2AXXX/DK88ABNA0496434500\n"
":28C:42/00002\n"
":60M:C230228EUR124792,65\n"
":61:2302280228C1750,88NTRFC1165-23-00120//656\n"
":86:/TRTP/SEPA OVERBOEKING/IBAN/DK47ABNA0243508514/BIC/ABNADK2A/NAME/\n"
"LOOP BV/REMI/AV-RUN 24022023/202301918/EREF/C1165-23-00120\n"
":61:2302280228C4695,98NTRF6381310605374038//656\n"
":86:/TRTP/SEPA OVERBOEKING/IBAN/DK14ABNA0456766324/BIC/ABNADK2A/NAME/\n"
"DEV BV/REMI/ID16145 DEB. 1657139 FACT. 202303668 20\n"
"2303685 202303689/EREF/638131060537403857-311-2\n"
":61:2302280228C1349,25NTRFNOTPROVIDED//658\n"
":86:/TRTP/SEPA OVERBOEKING/IBAN/DK46ABNA0513892443/BIC/ABNADK2A/NAME/\n"
"EXAMPLE COM/REMI/202303656/EREF/NOTPROVIDED\n"
":61:2302280228C55845,96NTRFNOTPROVIDED//658\n"
":86:/TRTP/SEPA OVERBOEKING/IBAN/DK35ABNA0442867689/BIC/ABNADK2A/NAME/\n"
"BATH COMPANY DK/REMI/INV. 202228255-8426, OUR REF 2022611\n"
"73-79/EREF/NOTPROVIDED\n"
":61:2302280228D105000,NTRFNOTPROVIDED//658\n"
":86:/TRTP/SEPA OVERBOEKING/IBAN/DK98INGB0657624985/BIC/INGBDK2A/NAME/\n"
"TEST/REMI/OVERBOEKING/EREF/NOTPROVIDED\n"
":62F:C230228EUR83434,72\n"
":64:C230228EUR83434,72\n"
":86:/ACSI/ABNADK2AXXX\n"
"-\n"
":20:STARTUMS TA FW\n"
":25:28020050/0521322890\n"
":28C:017/01\n"
":60F:C230228GBP1473111,27\n"
":61:2302280228D1919,29N020NONREF\n"
":86:206?00AUSL-ZAHLUNG?100004649?20COMPANY?21S LT\n"
"D?22TRN AZV2023022800746?23URSP.-BETR.1.900,00 GBP?24KURS 0,87716\n"
"0 EUR ZU GBP?25GEGENWERT 2.00,08 EUR?26PROVISION FIX 7\n"
",50 EUR?27SWIFT-/TELE-SPESEN 2,00 EUR?28FREMDE GEB. 12,50 E\n"
"UR?2917.02 413337?3028020050?310537246190?32HOMETESTEXAMPLE?33S \n"
"LTD?34003\n"
":61:2302280228D16988,81N020NONREF\n"
":86:206?00AUSL-ZAHLUNG?100004649?20BODO GU COM?21NOT A TEST?22TRN\n"
"AZV2023022800749?23URSP.-BETR.16.980,48 GBP?24\n"
"KURS 0,877160 EUR ZU GBP?25GEGENWERT 19.358,48 EUR?26PROVISIO\n"
"N FIX 7,50 EUR?27SWIFT-/TELE-SPESEN 2,00 EUR?2830.01 INV-278\n"
"0?29*LOREM*?3028020050?310537246190?32GOLL\n"
"?33GOL COM?34003?60INFO 0800-1234\n"
"*GEB-FREI*\n"
":61:2302280228D867,06N020NONREF\n"
":86:206?00AUSL-ZAHLUNG?100004649?20NOTACOMPANY?21LTD?2\n"
"2TRN AZV2023022800752?23URSP.-BETR.858,73 GBP?24KURS 0,877160 EUR\n"
" ZU GBP?25GEGENWERT 978,99 EUR?26PROVISION FIX 7,50 E\n"
"UR?27SWIFT-/TELE-SPESEN 2,00 EUR?2828.01 A221322?3028020050?31053\n"
"7246190?32KOLL?33LTD?34003\n"
":62F:C230228GBP1453336,11\n"
"-")
subst = ""
# You can manually specify the number of replacements by changing the 4th argument
result = re.sub(regex, subst, test_str, 0)
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