Document builtins.match, fixes #1145
This commit is contained in:
parent
47f587700d
commit
41d6523ef5
1 changed files with 29 additions and 0 deletions
|
@ -210,6 +210,35 @@ if builtins ? getEnv then builtins.getEnv "PATH" else ""</programlisting>
|
||||||
|
|
||||||
</varlistentry>
|
</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>
|
<varlistentry><term><function>builtins.elem</function>
|
||||||
<replaceable>x</replaceable> <replaceable>xs</replaceable></term>
|
<replaceable>x</replaceable> <replaceable>xs</replaceable></term>
|
||||||
|
|
Loading…
Reference in a new issue