ECMAScript RegExp implementation