# coding=utf8
# the above tag defines encoding for this document and is for Python 2.x compatibility
import re
regex = r"^C:\\Box\\Triton Clark Build\\Hull 718\\718 ~ (?!.*rchive|.*scaled_|.*Venues).*[\\].*939-.*\.dwg$"
test_str = ("C:\\Box\\Triton Clark Build\\Hull 718\\718 ~ T0162 - d01f6 - TR01-06.2-ENT\\939-0106-0018 - 0106.2-005 - WDT.dwg\n"
"C:\\Box\\Triton Clark Build\\Hull 718\\718 ~ T0162 - d01f6 - TR01-06.2-ENT\\939-0106-0019 - 0106.2-009 - WDT.dwg\n"
"C:\\Box\\Triton Clark Build\\Hull 718\\718 ~ T0251 - d02f5 - TR02-05.1-ENT\\Rack Models\\718 - 939-0205-0010 - 0205.1-011 - YACL.dwg\n"
"C:\\Box\\Triton Clark Build\\Hull 718\\718 ~ T0251 - d02f5 - TR02-05.1-ENT\\Rack Models\\718 - 939-0205-0011 - 0205.1-012 - YACL.dwg\n"
"C:\\Box\\Triton Clark Build\\Hull 718\\_Mechanical Drawings\\10-ENTPRJ\\Okugi & RealD files\\03_Christie Digital\\163-102104-01_Horizon 1LOS Exhaust Duct.STEP\n"
"C:\\Box\\Triton Clark Build\\Hull 718\\_Mechanical Drawings\\10-ENTPRJ\\VYV Balcony Projectors (ENTPRJ02)\\Archive\n"
"C:\\Box\\Triton Clark Build\\Hull 718\\_Mechanical Drawings\\10-ENTPRJ\\VYV Balcony Projectors (ENTPRJ02)\\Bildschirmfoto 2020-09-24 um 11.16.43.png\n"
"C:\\Box\\Triton Clark Build\\Hull 718\\_Mechanical Drawings\\10-ENTPRJ\\VYV Balcony Projectors (ENTPRJ02)\\Bildschirmfoto 2020-09-24 um 11.17.56.png\n"
"C:\\Box\\Triton Clark Build\\Hull 718\\_Shipwide Task Information\\QSC Change\\718 Triton Dante Bridge.pdf\n"
"C:\\Box\\Triton Clark Build\\Hull 718\\_Shipwide Task Information\\QSC Change\\Attero Tech to RDL Swap.txt\n"
"C:\\Box\\Triton Clark Build\\Hull 718\\_Shipwide Task Information\\QSC Change\\S718_QSC CABLE CHANGES.xlsm")
matches = re.finditer(regex, test_str, re.MULTILINE)
for matchNum, match in enumerate(matches, start=1):
print ("Match {matchNum} was found at {start}-{end}: {match}".format(matchNum = matchNum, start = match.start(), end = match.end(), match = match.group()))
for groupNum in range(0, len(match.groups())):
groupNum = groupNum + 1
print ("Group {groupNum} found at {start}-{end}: {group}".format(groupNum = groupNum, start = match.start(groupNum), end = match.end(groupNum), group = match.group(groupNum)))
# 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