NixOS / nix

Nix, the purely functional package manager
https://nixos.org/
GNU Lesser General Public License v2.1
12.62k stars 1.51k forks source link

Regex Syntax is inconsistent and under-documented #8768

Open iFreilicht opened 1 year ago

iFreilicht commented 1 year ago

Is your feature request related to a problem? Please describe. This comment shows that there is no clear documentation on what regex dialect our commands use, and after digging into it, I myself am left confused.

C++ itself uses modified ECMAScript regex syntax by default, and that is what most (24, to be exact) of internal invocations seem to use, but there's 7 invocations that specifically set std::regex::extended, which are related to nix search, nix profile, nix-env and builtins.regex.

Only the documentation of builtins.regex mentions that it uses POSIX extended regex syntax.

Describe the solution you'd like

Describe alternatives you've considered We could use ECMAScript syntax instead, which would be easier to keep consistent as it is the default and has some features that could be useful for package searching (like word boundaries), but this could be a breaking change.

Additional context None.

Priorities

Add :+1: to issues you find important.

sullyj3 commented 1 year ago

see also #3047, #1537