Skip to content

Instantly share code, notes, and snippets.

@dacr
Created March 28, 2025 09:02
Show Gist options
  • Save dacr/0946fce81d22f9d5eac92ba1c3017195 to your computer and use it in GitHub Desktop.
Save dacr/0946fce81d22f9d5eac92ba1c3017195 to your computer and use it in GitHub Desktop.
nix regex / published by https://github.com/dacr/code-examples-manager #5bb58db7-1af1-41a7-b835-3f1fc55c3baf/bd98af9ebc85a11957c64d02aa3ec11cfeb9bf14
## summary : nix regex
## keywords : nix, regex
## publish : gist
## authors : David Crosson
## license : Apache NON-AI License Version 2.0 (https://raw.githubusercontent.com/non-ai-licenses/non-ai-licenses/main/NON-AI-APACHE2)
## id : 5bb58db7-1af1-41a7-b835-3f1fc55c3baf
## created-on : 2025-02-07T17:13:13+01:00
## managed-by : https://github.com/dacr/code-examples-manager
## run-with : nix eval --file $file
#### run-with : nix-instantiate --eval $file
let
results = builtins.split "<([^>]+)>" "John Doe <[email protected]>";
in with builtins; {
first_matching_1 = (head (head (tail results))) ;
first_matching_2 = (elemAt results 1) ;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment