The previous regex would not work if there were points in the filename. Now it will handle up to two points which should be enough. Fixes #2306 (cherry picked from commit f05cbf0f)