This:

/[^\(]+\.(gif|jpg|jpeg|png|svg|bmp)[^;\s]*\)/gi

is very slow in JS.

I have tested this regular expression in the same code:

/a/gi

and it runs ultra quick, so it must be the regex, not the JS code.

Any ideas to speed it up?