about summary refs log tree commit diff
path: root/doc/manual/expressions/builtins.xml
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-08-16T19·21+0200
committerEelco Dolstra <edolstra@gmail.com>2017-08-16T19·21+0200
commit2ee1b9359b26e0d75c0ee885549fee4ad87131d1 (patch)
treea7b100e984fafb09238dcb5fe8277011cbc1ca56 /doc/manual/expressions/builtins.xml
parentc2cab207320672fb6ed4af40a99fc9082ff55234 (diff)
parentb8867a0239b1930a16f9ef3f7f3e864b01416dff (diff)
Merge branch 'tokenize' of https://github.com/nbp/nix
Diffstat (limited to 'doc/manual/expressions/builtins.xml')
-rw-r--r--doc/manual/expressions/builtins.xml37
1 files changed, 37 insertions, 0 deletions
diff --git a/doc/manual/expressions/builtins.xml b/doc/manual/expressions/builtins.xml
index 86c36da1b328..615314880aba 100644
--- a/doc/manual/expressions/builtins.xml
+++ b/doc/manual/expressions/builtins.xml
@@ -873,6 +873,43 @@ builtins.sort builtins.lessThan [ 483 249 526 147 42 77 ]
   </varlistentry>
 
 
+  <varlistentry><term><function>builtins.split</function>
+  <replaceable>regex</replaceable> <replaceable>str</replaceable></term>
+
+  <listitem><para>Returns a list composed of non matched strings interleaved
+  with the lists of the <link
+  xlink:href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_04">extended
+  POSIX regular expression</link> <replaceable>regex</replaceable> matches
+  of <replaceable>str</replaceable>. Each item in the lists of matched
+  sequences is a regex group.
+
+<programlisting>
+builtins.split "(a)b" "abc"
+</programlisting>
+
+Evaluates to <literal>[ "" [ "a" ] "c" ]</literal>.
+
+<programlisting>
+builtins.split "([ac])" "abc"
+</programlisting>
+
+Evaluates to <literal>[ "" [ "a" ] "b" [ "c" ] "" ]</literal>.
+
+<programlisting>
+builtins.split "(a)|(c)" "abc"
+</programlisting>
+
+Evaluates to <literal>[ "" [ "a" null ] "b" [ null "c" ] "" ]</literal>.
+
+<programlisting>
+builtins.split "([[:upper:]]+)" "  FOO   "
+</programlisting>
+
+Evaluates to <literal>[ "  " [ "FOO" ] "   " ]</literal>.
+
+  </para></listitem>
+  </varlistentry>
+
   <varlistentry><term><function>builtins.stringLength</function>
   <replaceable>e</replaceable></term>