Lea Verou on Nostr: π₯ Hot take: g should never have been a regexp flag β how you apply a regexp is ...
π₯ Hot take:
g should never have been a regexp flag β how you apply a regexp is not a conceptual part of the pattern, and thus it should be part of the API *using* the pattern (e.g. string.match() vs string.matchAll()), not the pattern itself.
A regexp is essentially data β it should be possible to pass a regexp to third-party code without knowing how said code will use it, and it should be possible to reuse the same regexp to match once or globally.
g should never have been a regexp flag β how you apply a regexp is not a conceptual part of the pattern, and thus it should be part of the API *using* the pattern (e.g. string.match() vs string.matchAll()), not the pattern itself.
A regexp is essentially data β it should be possible to pass a regexp to third-party code without knowing how said code will use it, and it should be possible to reuse the same regexp to match once or globally.