diff options
author | Nicolas B. Pierron <nicolas.b.pierron@gmail.com> | 2017-08-15T18·08+0000 |
---|---|---|
committer | Nicolas B. Pierron <nicolas.b.pierron@gmail.com> | 2017-08-15T20·04+0000 |
commit | b8867a0239b1930a16f9ef3f7f3e864b01416dff (patch) | |
tree | ce0154e733d0dd1a58d7472283a2bd64aed11659 /nix.spec.in | |
parent | f76e85d8f581cc8f71b66386e86ed93c2c3d6992 (diff) |
Add builtins.string function.
The function 'builtins.split' takes a POSIX extended regular expression and an arbitrary string. It returns a list of non-matching substring interleaved by lists of matched groups of the regular expression. ```nix with builtins; assert split "(a)b" "abc" == [ "" [ "a" ] "c" ]; assert split "([ac])" "abc" == [ "" [ "a" ] "b" [ "c" ] "" ]; assert split "(a)|(c)" "abc" == [ "" [ "a" null ] "b" [ null "c" ] "" ]; assert split "([[:upper:]]+)" " FOO " == [ " " [ "FOO" ] " " ]; ```
Diffstat (limited to 'nix.spec.in')
0 files changed, 0 insertions, 0 deletions