feat(regexp_search): port and modify from RegExp.prototype.search

Please review my code and give me some advice, thanks @tomchentw .
What does the `a` variable in  `function() { ++a; return "a"; }` do?