"This regular expression has been replaced with a substring function"

“This regular expression has been replaced with a substring function”

So, let me ask the /real/ question: What is the regex solution if one doesn’t want to cheat with a substring function?

+Erik Schnetter, replace

(.*?)\s$

with

\1

I think.

Ooo, or, maybe just anchor it so only the first space after a word is considered.

\b\s+$

Yes, that’s it! Thanks.

Use a different regular expression library. RE2 can match this in linear time iiuc.

I wonder… did they actually review all of their other regexps or did they commit resources to doing so? Because fixing just one regexp is patching the system, and not explicitly saying that they’ll fix everything else is a shortcoming of the postmortem…