import re
regex = re.compile(r"^CitrixReceiver\/(0*[1-9]\d\d|0*[2-9]\d|0*19\.0*[1-9]\d\d|0*19\.0*[1-9]\d\d|0*19\.0*[2-9]\d|0*19\.0*1[2-9])", flags=re.MULTILINE)
test_str = ("CitrixReceiver/0.0.0.0\n"
"CitrixReceiver/9999.9999.0.0\n"
"CitrixReceiver/19.12.0.0\n"
"CitrixReceiver/18.9876.1234.1111\n"
"CitrixReceiver/19.12.999.9999\n"
"CitrixReceiver/19.100.999.9999\n"
"CitrixReceiver/19.000100.999.9999\n"
"CitrixReceiver/00019.00012.0000.0000\n"
"CitrixReceiver/0019.0012.00999.009999\n"
"CitrixReceiver/20.0.0.0\n"
"CitrixReceiver/1.2.3.4\n"
"CitrixReceiver/19.13.3.4\n"
"CitrixReceiver/00019.2.3.4\n"
"CitrixReceiver/000100.2.3.4\n\n\n\n\n\n\n")
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