about summary refs log tree commit diff
path: root/release-common.nix
diff options
context:
space:
mode:
authorNicolas B. Pierron <nicolas.b.pierron@gmail.com>2017-08-15T18·08+0000
committerNicolas B. Pierron <nicolas.b.pierron@gmail.com>2017-08-15T20·04+0000
commitb8867a0239b1930a16f9ef3f7f3e864b01416dff (patch)
treece0154e733d0dd1a58d7472283a2bd64aed11659 /release-common.nix
parentf76e85d8f581cc8f71b66386e86ed93c2c3d6992 (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 'release-common.nix')
0 files changed, 0 insertions, 0 deletions