jeudi 30 mars 2017

regex match file with multiple extension

I have several strings like this

XYZ_TEST_2017.txt

ASD_TEST_2017.txt.tmp

I need to extract only those strings with only .txt lasting

So I'm using this regex:

[A-Z]{3}TEST[0-9]{4}.txt

However I still get the strings with multiple extensions like the second one (.txt.tmp)

http://ift.tt/2oaZvHK

How can I handle it?

Thanks

Aucun commentaire:

Enregistrer un commentaire