mirror of
https://github.com/NixOS/nix.git
synced 2025-11-09 12:06:01 +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-topics | ||
| command-ref | ||
| expressions | ||
| figures | ||
| glossary | ||
| images/callouts | ||
| installation | ||
| introduction | ||
| packages | ||
| release-notes | ||
| troubleshooting | ||
| hacking.xml | ||
| local.mk | ||
| manual.xml | ||
| nix-lang-ref.xml | ||
| quote-literals.xsl | ||
| schemas.xml | ||
| style.css | ||