man-pages/man3/pcre2_pattern_convert.3.html
2021-03-31 01:06:50 +01:00

89 lines
3.8 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of PCRE2_PATTERN_CONVERT</TITLE>
</HEAD><BODY>
<H1>PCRE2_PATTERN_CONVERT</H1>
Section: C Library Functions (3)<BR>Updated: 11 July 2017<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
PCRE2 - Perl-compatible regular expressions (revised API)
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<P>
<B>#include &lt;<A HREF="file:///usr/include/pcre2.h">pcre2.h</A>&gt;</B>
<P>
<PRE>
<B>int pcre2_pattern_convert(PCRE2_SPTR </B><I>pattern</I>, PCRE2_SIZE <I>length</I>,
<B> uint32_t </B><I>options</I>, PCRE2_UCHAR **<I>buffer</I>,
<B> PCRE2_SIZE *</B><I>blength</I>, pcre2_convert_context *<I>cvcontext</I>);
</PRE>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
<P>
This function is part of an experimental set of pattern conversion functions.
It converts a foreign pattern (for example, a glob) into a PCRE2 regular
expression pattern. Its arguments are:
<P>
<BR>&nbsp;&nbsp;<I>pattern</I>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;foreign&nbsp;pattern
<BR>&nbsp;&nbsp;<I>length</I>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;length&nbsp;of&nbsp;the&nbsp;input&nbsp;pattern&nbsp;or&nbsp;PCRE2_ZERO_TERMINATED
<BR>&nbsp;&nbsp;<I>options</I>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Option&nbsp;bits
<BR>&nbsp;&nbsp;<I>buffer</I>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Pointer&nbsp;to&nbsp;pointer&nbsp;to&nbsp;output&nbsp;buffer,&nbsp;or&nbsp;NULL
<BR>&nbsp;&nbsp;<I>blength</I>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Pointer&nbsp;to&nbsp;output&nbsp;length&nbsp;field
<BR>&nbsp;&nbsp;<I>cvcontext</I>&nbsp;&nbsp;&nbsp;Pointer&nbsp;to&nbsp;a&nbsp;convert&nbsp;context&nbsp;or&nbsp;NULL
<P>
The length of the converted pattern (excluding the terminating zero) is
returned via <I>blength</I>. If <I>buffer</I> is NULL, the function just returns
the output length. If <I>buffer</I> points to a NULL pointer, heap memory is
obtained for the converted pattern, using the allocator in the context if
present (or else <B>malloc()</B>), and the field pointed to by <I>buffer</I> is
updated. If <I>buffer</I> points to a non-NULL field, that must point to a
buffer whose size is in the variable pointed to by <I>blength</I>. This value is
updated.
<P>
The option bits are:
<P>
<BR>&nbsp;&nbsp;PCRE2_CONVERT_UTF&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Input&nbsp;is&nbsp;UTF
<BR>&nbsp;&nbsp;PCRE2_CONVERT_NO_UTF_CHECK&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Do&nbsp;not&nbsp;check&nbsp;UTF&nbsp;validity
<BR>&nbsp;&nbsp;PCRE2_CONVERT_POSIX_BASIC&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Convert&nbsp;POSIX&nbsp;basic&nbsp;pattern
<BR>&nbsp;&nbsp;PCRE2_CONVERT_POSIX_EXTENDED&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Convert&nbsp;POSIX&nbsp;extended&nbsp;pattern
<BR>&nbsp;&nbsp;PCRE2_CONVERT_GLOB&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;)&nbsp;Convert
<BR>&nbsp;&nbsp;PCRE2_CONVERT_GLOB_NO_WILD_SEPARATOR&nbsp;&nbsp;)&nbsp;&nbsp;&nbsp;various&nbsp;types
<BR>&nbsp;&nbsp;PCRE2_CONVERT_GLOB_NO_STARSTAR&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;of&nbsp;glob
<P>
The return value from <B>pcre2_pattern_convert()</B> is zero on success or a
non-zero PCRE2 error code.
<P>
The pattern conversion functions are described in the
<B>pcre2convert</B>
documentation.
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="1"><A HREF="#lbAB">NAME</A><DD>
<DT id="2"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="3"><A HREF="#lbAD">DESCRIPTION</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:50 GMT, March 31, 2021
</BODY>
</HTML>