use a regex (that actually works!)
Merge pull request #1 from pooriaazimi/master

Bugfix (missing dots if filename contained more dot than dot before extension - i.e. image.name.png -> would become imagename@2x.png after processing) and removed loop in favour of regexp