about summary refs log tree commit diff
path: root/doc/manual
diff options
context:
space:
mode:
authorDomen Kožar <domen@dev.si>2016-12-09T19·40+0100
committerDomen Kožar <domen@dev.si>2016-12-09T19·40+0100
commit41d6523ef57c3b35483eeef7cb85eb6c6a84aeb2 (patch)
tree6ec1b79f161f6aa79943ed04232397836d52a599 /doc/manual
parent47f587700d646f5b03a42f2fa57c28875a31efbe (diff)
Document builtins.match, fixes #1145
Diffstat (limited to 'doc/manual')
-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 9517f20106ef..063bc04be483 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>