Fix .startsWith and .endsWith with regular expressions.

First of all, I'm already aware builds for this test fail (however, they don't fail on Travis, some bug testing problem?) - this is caused by me not knowing how to compile files in `release` (I tried using `create_release.rb`, but it doesn't work for me). Anyway, I decided to remove `.replace()`, as the `.replace` here is IMO pointless, and only added bugs.

The old code was replacing `^` with nothing (only once, for some reason). I believe it's a mistake, as it breaks regular expressions containing `^` (most notably, escaped `^` and negated character ranges, like `[^abc]`). It causes lots of interesting bugs. If you change `/\^/` into `/^\/`, you get a syntax error. Similarly, if you change `/[^k]/` into `/^[k]/`, you make opposite of what user intended. This is bad. The regular expression like `/^^^^^^^^^^^^^^^^/` means exactly the same thing as `/^/` (ignoring [certain old, already fixed bug in V8](https://code.google.com/p/v8/issues/detail?id=909)), so the removal is not even necessary.

There is also another bug, not related to replacement - the code was adding `^` or `$` without ensuring correct precedence. I've added parens, in order to ensure regular expression like `/a|b/` will be parsed as `/^(?:a|b)/`, not `/^a|b/`.