Hi all,
Â
I need a hand integrating this python regex script into the python caller, I basically want to run as per below. I have it all working in python but now have been asked (as work uses FME) to do it here. I'm struggling to understand how to integrate python into the FME workflow.
Â
if you could assist setting this up in a basic manner I'm sure I will get the hang of it, but have been struggling for a day or two.
Â
(Also I know I could not use python, but I want to extend beyond this functionality later and prefer python)
Â
My python script is around the lines of:
Â
def check_filename(filename):
  pattern = r'^(&A-Z]{3}-\\d{3}-\A-Z]--A-Z]{3}-MOD-\\d{2}-\A-Z]{3}--A-Z]{3}-\\d{4})(-dA-Z]-\\d{2})?(\\.\\w{3,4})$'
  match = re.match(pattern, filename)
 Â
  return bool(match), filename if not match else ""
Â
def check_all_files():
  for filename in filenames_:
    result, reason = check_filename(filename)
    if result:
      passes.append(filename)
    else:
      fails.append((filename, 'Not meeting schema or placed incorrect folder. Please amend to this schema.'))
Â