-
-
-def match_rep_in_file(regex, full_path):
- if not os.path.isfile(full_path):
- raise Exception('File(%s) does not exist' % full_path)
-
- with open(full_path, 'r') as file:
- for line in file:
- result = re.search(regex, line)
- if result:
- return result.group(0)
-
- return None