fixed greedy parser, even with minified html

Previous fix didn't actually work well when HTML was minified (without line breaks).
This one takes better approach, it does regex replacement only on a splitted tag (not entire HTML which may contain further replaceable elements).
Because of lack of regex lookbehind constructs in JS, it wasn't possible to do it in pure regex. That is why I also could restore original regex.