Use a "correct" algorithm (with a simple regex)

Hi,

I was about to create something similar to your code that I stumbled upon your project. However, I'm not sure if it actually works - it removes all the dots in the src:

```
> src = 'http://www.google.com/images/logo.jpg';
'http://www.google.com/images/logo.jpg'

> arr = src.split('.');
[ 'http://www',
  'google',
  'com/images/logo',
  'jpg' ]
> name = '';
''
> for(var j = 0; j < (arr.length - 1); j++) {
... name += arr[j];
... }
'http://wwwgooglecom/images/logo'

> name += '@2x.';
'http://wwwgooglecom/images/logo@2x.'

> name += arr[(arr.length - 1)];
'http://wwwgooglecom/images/logo@2x.jpg'
```

You have to add a '.' inside the loop too. I edited the file and used a more elegant regex instead.

Thanks.