Hi everyone! I'm very new to using RegEx and cannot seem to figure out how to accomplish the following with these file names from the Directory tool:
Any assistance would be greatly appreciated. Thanks!
Solucionado! Ir para Solução.
Hi @thenning
Here's some examples:
Filter files:
REGEX_Match([FileName], 'CPSC_Contract_Info_\d{4}_\d{2}.csv')
OR
REGEX_Match([FileName], 'CPSC_Enrollment_Info_\d{4}_\d{2}.csv')
Replace underscore:
REGEX_Replace([FileName], '(.*\d{4})(_)(\d{2}.*)','$1-$3')
Isolate yyyy-mm:
REGEX_Replace([FileName], '.*(\d{4}.\d{2}).*','$1')
Thanks @Luke_C, that did it. I appreciate your help.
Hi @thenning - as someone who has only recently fallen down the rabbit hole of regex, I find this website a great source for regex. https://regex-generator.olafneumann.org/. You can paste your expression in and using the UI, isolate how you want to identify it and it will produce the required regex. It is by no means foolproof, but a good place to start and then make further tweaks to get to what you finally need.
This site is really great to test regex https://regex-generator.olafneumann.org/. Thanks @mark007