The regex-function was necessary because the OP was asking to put a space if the following char was a letter, and no space elsewhere. But if you decide to keep it as the editor wrote it (with or without a space), you're right, no need for of a function.
But if the purpose is to unify the notations, maybe it's good to decide when to put or to strip out a space? In this case, a function can make the job (for example, if we want to strip spaces between ellipsis and quotation marks, and to force a space elsewhere).
You're also perfectly right about \s instead spaces, I should have done it, but as I was replying to his specific request…
Anyway, I'm glad I could help you with this regex.
Last edited by lomkiri; 02-24-2023 at 02:34 PM.
|