Regular expression to recognize files with the following templates az.4.0.0.119.tgz

advertisements

I am trying to find a regular expression that will recognize files with the pattern as az.4.0.0.119.tgz. I have tried the regular expression below:

([a-z]+)[.][0-9]{0,3}[.][0-9]{0,3}[.][0-9]{0,3}[.]tgz

But, no luck. Can anyone please point me in the right direction.

Regards, Shreyas


Better to use a simple regex like this:

^([a-z]+)\.(?:[0-9]+\.)+tgz$