Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't match case insensitive with builtins.match #10682

Closed
Libadoxon opened this issue May 11, 2024 · 2 comments
Closed

Can't match case insensitive with builtins.match #10682

Libadoxon opened this issue May 11, 2024 · 2 comments
Labels
feature Feature request or proposal language The Nix expression language; parser, interpreter, primops, evaluation, etc

Comments

@Libadoxon
Copy link

Is your feature request related to a problem? Please describe.
You can't match case insensitive with builtins.match, I think nix uses ECMAScript regex which doesn't support pearl extensions like (?i). In c++ you can pass additional arguments to std::regex pattern() to make it match case insensitive, for example:

std::regex pattern("Some Pattern", std::regex_constants::icase);

But to my knowledge you can't pass anything to builtins.match except for the pattern/expression

Describe the solution you'd like
Make builtins.match support the pearl extensions

Describe alternatives you've considered
Allow passing of additional arguments to std::regex pattern()

Priorities

Add 👍 to issues you find important.

@Libadoxon Libadoxon added the feature Feature request or proposal label May 11, 2024
@fricklerhandwerk fricklerhandwerk added the language The Nix expression language; parser, interpreter, primops, evaluation, etc label May 15, 2024
@fricklerhandwerk
Copy link
Contributor

Triaged in Nix team meeting:

  • @edolstra: this would require a notion of case, which goes into character sets. Overall an "interesting" problem
  • @roberth: also a reproducibility hazard because of locales
  • closing, the effort-value ratio is questionable. if many people want it, we can take a look again; would need a concrete proposal how it should work

@fricklerhandwerk fricklerhandwerk closed this as not planned Won't fix, can't repro, duplicate, stale May 15, 2024
@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/2024-05-15-nix-team-meeting-minutes-146/45491/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Feature request or proposal language The Nix expression language; parser, interpreter, primops, evaluation, etc
Projects
None yet
Development

No branches or pull requests

3 participants