readline: replace quadratic regex with linear one
Simplify regular expression in _wordLeft readline method.
Note: If the test can be improved in any way, let me know. Tried using FakeInput
, but writing one million characters takes a very long time. Or should a benchmark be used instead of the test?
Fixes https://github.com/nodejs/node/issues/26596
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
commit message follows commit guidelines