Regex to extract words from filenames

Good morning friends:

A query please, how would a regex be to extract the words that are in the middle of TBM MAIL and 02-17 (It is a dd-MM date and may vary).

TBM MAIL MY HOME 17-02.xlsx
TBM MAIL BLUE-RED 16-02.xlsx
TBM MAIL CONTINENTAL 14-02.xlsx
TBM MAIL SUR CHICO 13-02.xlsx
TBM MAIL CMM.ATV COLM 11-02.xlsx

1 Like

Hey @Lynx

Kindly try the below…

(?<=TBM MAIL)(.*?)(?=\d{2}-\d{2}.)

Hope this helps.

Thanks
#nK

Thank you very much for responding Nithin, just at this moment I have just reviewed other files and I have realized that the date has several ways of appearing

Here I have three cases:

TBM MAIL CERRO VERDE 1202.xlsx
TBM MAIL LURIN 13.02.xlsx
TBM MAIL ATACAMA 16 02.xlsx

Cheers

1 Like

Hey @Lynx

Please try the updated below…

(?<=TBM MAIL)(.*?)(?=\d.)

Thanks
#nK

1 Like

Thanks Nithin

1 Like

Cool @Lynx

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.