import re
regex = re.compile(r"(?<=Restoration Coder: )([a-zA-Z.\s]+)([\d.,]+)", flags=re.MULTILINE)
test_str = ("Restoration Coder: Mr. Vivek Patel 203.75 203.75\n"
"Attn: Mr. Rod Smallwood (WO# 21541416)\n"
"e/o Sod Repairs (Sinkage, Immediate Response)\n"
"74 Stuart St. (StOLItTville)\n"
"Restoration Coder: Mr. Vivek roy 267.11 267.11\n"
"Attn: Mr. Rod Smallwood (WO# 24021301)\n"
"cx’o Sod Repairs (Removal ofspoils? Topsoila‘Seeding)\n"
"75 George St (Aurora)\n"
"Restoration Coder: Mr. arin Patel 251.85 251.85\n"
"Attn: Mr. Rod Smallwood (WO# 23512606)\n"
"010 Interlocking Brick Repairs\n"
"143 Spruce St (Aurora)\n"
"Restoration Coder: Mr. arin Patel 25185 251.85\n"
"Attn: Mr. Rod Smallwood (WO# 23512606)\n"
"010 Interlocking Brick Repairs\n"
"143 Spruce St (Aurora)\n"
"Restoration Coder: Mr. arin Patel 2,185.00 251.85\n"
"Attn: Mr. Rod Smallwood (WO# 23512606)\n"
"010 Interlocking Brick Repairs\n"
"143 Spruce St (Aurora)")
matches = regex.finditer(test_str)
for match_num, match in enumerate(matches, start=1):
print(f"Match {match_num} was found at {match.start()}-{match.end()}: {match.group()}")
for group_num, group in enumerate(match.groups(), start=1):
print(f"Group {group_num} found at {match.start(group_num)}-{match.end(group_num)}: {group}")
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