mirror of
https://github.com/NixOS/nix.git
synced 2025-11-09 20:16:03 +01:00
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" ] " " ];
```
|
||
|---|---|---|
| .. | ||
| advanced-attributes.xml | ||
| arguments-variables.xml | ||
| build-script.xml | ||
| builder-syntax.xml | ||
| builtins.xml | ||
| debug-build.xml | ||
| derivations.xml | ||
| expression-language.xml | ||
| expression-syntax.xml | ||
| generic-builder.xml | ||
| language-constructs.xml | ||
| language-operators.xml | ||
| language-values.xml | ||
| simple-building-testing.xml | ||
| simple-expression.xml | ||
| writing-nix-expressions.xml | ||