Updated the regex to make it work when putting the hash after '?'

I am using `${name}.${ext}?${hash}` as `fileNameFormat ` and I noticed the task appended the hash each time, without clearing the last one.

This commit is my attempt to fix it. It works for me, but it is not as universal as it should be, I suppose.