# coding=utf8
# the above tag defines encoding for this document and is for Python 2.x compatibility
import re
regex = r"(?!cm)(?<=Raw Va.ue ;)(?P<v1>.*)Raw Va.ue ;(?P<v2>.*)(?=;Penalty)"
test_str = ("1 \n"
"\"Simulator is not connected to SimNowlLink ;teports ;'ERFORMANCE REPORT ;USER: ;EXERCISE: ;ATTEMPT, ;NOTES: ;IDemoUser ;Ring Rollercoaster 1 ;SCORE: ;26 ;88 ;DATE: 09/04/2020 08:20:36 ;Pay attention to all penalties. You ;can improve drops by following this ;advice: ;• handle grasped objects ;carefully, use the wristed ;instruments to properly position ;object in the grasper. ;camera clutch to optimize your ;field of view. ;LAUNCH EXERCISE ;SURGICAL' ;SCORE BREAKDOWN: ;Efficiency Metrics ;Economy of ;Time to Complete ;Raw Value ;178.0 cm ;129.1 sec. ;50.0 ;50.0 ;Efficiency Subtotat ;Penalties ;Ring Collision Warning (Yellow) ;Ring Excessive Force (Red) ;Instrument-Instrument Collisions ;Instrument-Endoscope Collisions ;Endoscope-Environment Collisions ;Excessive Force ;Drops ;Instruments Out of View ;Raw Vatue ;13.0 ct. ;0.0 ct. ;0.0 ct. ;0.0 ct. ;0.0 ct. ;0.0 sec. ;2.0 ct. ;1.0 ct. ;Penalty Subtotal ;Overall Score ;pts. ;65.3 ;28.9 ;94 ;-1.3 ;-0.0 ;-0.0 ;-0.0 ;-0.0 ;-0.0 ;-4.0 ;-0.3 ;-6 ;88 ;k. ; \n\n"
"2 \n"
"\"Simulator is not connected to SimNowlLink ;Reports ;PERFORMANCE REPORT ;IPtmoUser ;USE R?' ;Ring Rollercoaster 1 ;EXERCISE: ;ATT ÉivlPT ;27 ;DATE: 09/04/2020 ;SCORE BREAKDOWN', ;NOTES: ;Really focus on improving drops by ;following these ;0' handle grasped objectS ;carefully, use the wristed ;instruments to properly position ;object in the grasper. ;•j camera clutch to optimize your ;field of view. ;NCH €XERCISE ;INTUITIVE ;SURGICAL v ;SCORE: ;Raw Value ;177.7 cm ;143.4 sec. ;Efficiency hetrics ;Economy bf Åotion ;Time to Complete ;Penalties ;Efficiency Subtotal ;Ring Collision Warning (Yéllow) ;Ring Excessive Force (Red) ;Instrument-Instrument Collisions ;instrument•Endoscope Collisions ;'Endoscope-Environment Collisions ;Excessive Force ;Drops ;Instruments Out of View ;Raw Value ;14.0 ct. ;0.0 ct. ;0.0 ct. ;0.0 ct. ;0.0 ct. ;0.4 sec. ;3.0 ct. ;0.0 ct. ;Max Pts. ;50.0 65.4 ;50.0 23.8 ;89 ;-0.0 ;-0.0 ;-0.0 ;-0.0 ;-6.0 ;-0.0 ;Penalty Subtotal ;Overall Score ; \n\n"
"3 \n"
"\"Simulator is not connected to SimNowlLink ;Reports ;PERFORMANCE REPORT ;USER: ;EXERCISE: ;ATTEMPT ;NOTES: ;DemoUser ;Ring Rollercoaster 1 ;28 ;DATE: 09/04/2020 ;SCORE: ;95 ;Good job improving drops! Continue ;to follow this advice to score even ;better: ;SCORE BREAKDOWN: ;Efficiency Metrics ;Economy of Motion ;Time to Complete ;Efficiency Subtotal ;Penalties ;Ring Cottision Warning (Yellow) ;Ring Excessive Force (Red) ;Instrument.lnstrument Collisions ;Instrument -Endoscope Collisions ;Endoscope-Environment Collisions ;Excessive Force ;Drops ;Instruments Out of View ;Raw Value ;149.5 cm ;101.5 sec. ;Raw Value ;8.0 ct. ;0.0 ct. ;0.0 ct. ;0.0 ct. ;0.0 ct. ;0.0 sec. ;2.0 ct. ;1.0 ct. ;50.0 ;50.0 ;• ;• ;handle grasped objects ;carefully, use the wristed ;instruments to properly position ;object in the grasper. ;camera clutch to optimize your ;field of view. ;LAUNCH EXERCISE ;INTUITIVE ;SURGICAL' ;Penalty Subtotal ;Overall Score ;pts. ;70.1 ;38.7 ;too ;-0.8 ;-0.0 ;-0.0 ;-0.0 ;-0.0 ;-0.0 ;-4.0 ;.0.3 ;-5 ;95 ; \n\n"
"4 \n"
"\"Simulator is not connected to SimNowlLink ;Reports ;PERFORMANCE REPORT ;USER: ;EXERCISE: ;ATTEMPT: ;NOTES: ;DemoUser ;Ring Rollercoaster 1 ;29 ;DATE: 09/04/2020 ;SCORE BREAKDOWN: ;Efficiency Metrics ;Economy of Motioh ;Time to Complete ;SCORE: ;Raw Value ;170.8 cm ;138.3 sec. ;Really focus on improving drops by ;following these techniques: ;• handle grasped objects ;carefully, use the wristed ;instruments to properly position ;object in the grasper. ;• camera clutch to optimize your ;field of view. ;LAUNCH EXERCISE ;INTUITIVE ;SURGICAL r ;Efficiency Subtotat ;Penalties ;Raw Value ;Ring Collision Warning (Yellow) ;, 14.0 ct. ;0.0 ci. ;Ring Excessive Force (Red) ;Instrument-Instrument Collisions ;0.0 ct. ;Instrument-Endoscope CollisionS ;0.0 ct. ;Endoscope-Environment Collisions ;0.0 ct. ;Excessive Force ;0.0 sec. ;Drops ;5.0 ct. ;Instruments Out of View ;0.0 ct. ;Penalty Subtotal ;Overall Score ;Pts. ;50.0 66.5 ;50.0 25.6 ;92 ;-1.4 ;-0.0 ;-0.0 ;-0.0 ;-0.0 ;-0.0 ;-10.0 ;-0.0 ;-11 ;81 ; \n\n"
"5 \n"
"\"Simulator is not connected to SimNowlLink ;Reports ;PERFORMANCE REPORT ;USER: ;EXERCISE: ;ATTEMPt ;NOTES: ;DemoUser ;Ring Rollercoaster 1 ;31 ;DATE: 09/04/2020 08:33:34 ;SCORE BREAKDOWN: ;SCORE: ;85 ;Good job improving drops! , Continue ;to follow this advice to score, even ;better:, ;• handle grasped objects ;carefully, use the wristed ;instruments to properly position ;object in the grasper. ;• camera clutch to optimize your ;field of view. ;LAUNCH EXERCISE ;INTUITIVE ;SURGICAL r ;Efficiency Metrics ;Economy of Motion ;Time to Complete ;Raw Value ;164.8 cm ;136.6 sec. ;Efficiency Subtotal. ;Penalties ;Ring Collision Warning (Yellow) ;Ring Excessive Force (Red) ;Instrument-instrument Collisions ;Instrument-Endoscope Collisions ;Endoscope-Environment Cottisions ;Excessive Force ;Drops ;Instruments Out of View ;Raw Value ;7.0 ct. ;0.0 ct. ;0.0 ct. ;0.0 ct. ;0.0 ct. ;0.0 sec. ;4.0 ct. ;1.0 ct. ;Penalty Subtotal ;Overall Score ;Pts. ;50.0 67.5 ;50.0 26.2 ;-0.7 ;-0.0 ;-0.0 ;-0.0 ;-0.0 ;-8.0 ;-0.3 ;85 ; \n\n")
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