Last active
May 31, 2018 08:06
-
-
Save betaboon/d0e2d3255dbfab711a9e2428e1c0aeec to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
macOS+Nix2.0.1 | |
-------------- | |
Welcome to Nix version 2.0.1. Type :? for help. | |
nix-repl> builtins.match “^(@([^\/]+?)[\/])?([^\/]+?)$” “ml-package-name” | |
error: invalid regular expression ‘^(@([^/]+?)[/])?([^/]+?)$’, at (string):1:1 | |
nixos+Nix2.0.1 | |
-------------- | |
Welcome to Nix version 2.0.1. Type :? for help. | |
nix-repl> builtins.match "^(@([^\/]+?)[\/])?([^\/]+?)$" "ml-package-name" | |
[ null null "ml-package-name" ] | |
REGEX | |
----- | |
^(@([^\/]+?)[\/])?([^\/]+?)$ - works on linux, breaks on darwin | |
^(@([^\/]+)[\/])*([^\/]+)$ - works on linux and darwin | |
FIX !? | |
------ | |
nix-repl> builtins.match "^(@([^\/]+)[\/])*([^\/]+)$" "ml-package-name" | |
[ null null "ml-package-name" ] | |
nix-repl> builtins.match "^(@([^\/]+)[\/])*([^\/]+)$" "foo/ml-package-name" | |
null | |
nix-repl> builtins.match "^(@([^\/]+)[\/])*([^\/]+)$" "@foo/ml-package-name" | |
[ "@foo/" "foo" "ml-package-name" ] | |
nix-repl> builtins.match "^(@([^\/]+?)[\/])?([^\/]+?)$" "ml-package-name" | |
[ null null "ml-package-name" ] | |
nix-repl> builtins.match "^(@([^\/]+?)[\/])?([^\/]+?)$" "foo/ml-package-name" | |
null | |
nix-repl> builtins.match "^(@([^\/]+?)[\/])?([^\/]+?)$" "@foo/ml-package-name" | |
[ "@foo/" "foo" "ml-package-name" ] |
Author
betaboon
commented
May 31, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment