aboutsummaryrefslogtreecommitdiff
path: root/doc/manual/expressions/builtins.xml
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2016-12-15 12:31:52 +0100
committerEelco Dolstra <edolstra@gmail.com>2016-12-15 12:31:52 +0100
commit5278bb7c16c227d64551fc6578cb1b1b22f3b036 (patch)
tree1b5af104e7fadaf20b9caea9964e4a4da82ac192 /doc/manual/expressions/builtins.xml
parent1df82b62456b3194b3d8be0562e886cf16bf9379 (diff)
parentf867f090ed198e0e7f7e2db32b9e282883bf63b7 (diff)
Merge branch 'master' of github.com:NixOS/nix
Diffstat (limited to 'doc/manual/expressions/builtins.xml')
-rw-r--r--doc/manual/expressions/builtins.xml29
1 files changed, 29 insertions, 0 deletions
diff --git a/doc/manual/expressions/builtins.xml b/doc/manual/expressions/builtins.xml
index 9517f2010..063bc04be 100644
--- a/doc/manual/expressions/builtins.xml
+++ b/doc/manual/expressions/builtins.xml
@@ -210,6 +210,35 @@ if builtins ? getEnv then builtins.getEnv "PATH" else ""</programlisting>
</varlistentry>
+ <varlistentry><term><function>builtins.match</function>
+ <replaceable>regex</replaceable> <replaceable>str</replaceable></term>
+
+ <listitem><para>Returns a list if
+ <replaceable>regex</replaceable> matches
+ <replaceable>str</replaceable> precisely, otherwise returns <literal>null</literal>.
+ Each item in the list is a regex group.
+
+<programlisting>
+builtins.match "ab" "abc"
+</programlisting>
+
+Evaluates to <literal>null</literal>.
+
+<programlisting>
+builtins.match "abc" "abc"
+</programlisting>
+
+Evaluates to <literal>[ ]</literal>.
+
+<programlisting>
+builtins.match "a(b)(c)" "abc"
+</programlisting>
+
+Evaluates to <literal>[ "b" "c" ]</literal>.
+
+
+ </para></listitem>
+ </varlistentry>
<varlistentry><term><function>builtins.elem</function>
<replaceable>x</replaceable> <replaceable>xs</replaceable></term>