role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>quote_literal</primary>
</indexterm>
<function>quote_literal</function> ( <type>text</type> )
<returnvalue>text</returnvalue>
</para>
<para>
Returns the given string suitably quoted to be used as a string literal
in an <acronym>SQL</acronym> statement string.
Embedded single-quotes and backslashes are properly doubled.
Note that <function>quote_literal</function> returns null on null
input; if the argument might be null,
<function>quote_nullable</function> is often more suitable.
See also <xref linkend="plpgsql-quote-literal-example"/>.
</para>
<para>
<literal>quote_literal(E'O\'Reilly')</literal>
<returnvalue>'O''Reilly'</returnvalue>
</para></entry>
</row>
<row>
<entry role="func_table_entry"><para role="func_signature">
<function>quote_literal</function> ( <type>anyelement</type> )
<returnvalue>text</returnvalue>
</para>
<para>
Converts the given value to text and then quotes it as a literal.
Embedded single-quotes and backslashes are properly doubled.
</para>
<para>
<literal>quote_literal(42.5)</literal>
<returnvalue>'42.5'</returnvalue>
</para></entry>
</row>
<row>
<entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>quote_nullable</primary>
</indexterm>
<function>quote_nullable</function> ( <type>text</type> )
<returnvalue>text</returnvalue>
</para>
<para>
Returns the given string suitably quoted to be used as a string literal
in an <acronym>SQL</acronym> statement string; or, if the argument
is null, returns <literal>NULL</literal>.
Embedded single-quotes and backslashes are properly doubled.
See also <xref linkend="plpgsql-quote-literal-example"/>.
</para>
<para>
<literal>quote_nullable(NULL)</literal>
<returnvalue>NULL</returnvalue>
</para></entry>
</row>
<row>
<entry role="func_table_entry"><para role="func_signature">
<function>quote_nullable</function> ( <type>anyelement</type> )
<returnvalue>text</returnvalue>
</para>
<para>
Converts the given value to text and then quotes it as a literal;
or, if the argument is null, returns <literal>NULL</literal>.
Embedded single-quotes and backslashes are properly doubled.
</para>
<para>
<literal>quote_nullable(42.5)</literal>
<returnvalue>'42.5'</returnvalue>
</para></entry>
</row>
<row>
<entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>regexp_count</primary>
</indexterm>
<function>regexp_count</function> ( <parameter>string</parameter> <type>text</type>, <parameter>pattern</parameter> <type>text</type>
<optional>, <parameter>start</parameter> <type>integer</type>
<optional>, <parameter>flags</parameter> <type>text</type> </optional> </optional> )
<returnvalue>integer</returnvalue>
</para>
<para>
Returns the number of times the POSIX regular
expression <parameter>pattern</parameter> matches in
the <parameter>string</parameter>; see
<xref linkend="functions-posix-regexp"/>.
</para>
<para>
<literal>regexp_count('123456789012', '\d\d\d', 2)</literal>
<returnvalue>3</returnvalue>
</para></entry>
</row>
<row>
<entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>regexp_instr</primary>
</indexterm>
<function>regexp_instr</function> ( <parameter>string</parameter> <type>text</type>, <parameter>pattern</parameter>