FIX: On v8, a regular expression was crashing

On v8, a regular expression was crashing if an image had no ending
parens. Interestingly enough, this doesn't happen in other browsers so
it seems to be v8 specific. This patch prevents it from happening and
adds a test.