Skip to content

Regex Syntax is inconsistent and under-documented #8768

@iFreilicht

Description

@iFreilicht

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

  • Somehow ensure that we use POSIX extended syntax in all CLI commands.
  • Document that all CLI commands are using POSIX extended syntax.

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 👍 to issues you find important.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions