What is Nostr?
Lea Verou /
npub1m6e…yan3
2024-08-28 02:31:41

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.
Author Public Key
npub1m6e8q4lxpwxhjcczsjfsnf79g24pcuvppzlysycgdh40jyualamqapyan3