PCRE2 — Perl-compatible regular expressions (revised API)
#include <pcre2.h> int pcre2_pattern_convert(PCRE2_SPTRpattern
, PCRE2_SIZElength
, uint32_toptions
, PCRE2_UCHAR **buffer
, PCRE2_SIZE *blength
, pcre2_convert_context *cvcontext
);
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:
pattern
The foreign patternlength
The length of the input pattern or PCRE2_ZERO_TERMINATEDoptions
Option bitsbuffer
Pointer to pointer to output buffer, or NULLblength
Pointer to output length fieldcvcontext
Pointer to a convert context or NULL
The length of the converted pattern (excluding the
terminating zero) is returned via blength
. If buffer
is NULL, the function just returns
the output length. If buffer
points to a NULL pointer, heap memory is obtained for the
converted pattern, using the allocator in the context if
present (or else malloc
()), and
the field pointed to by buffer
is updated. If buffer
points to
a non-NULL field, that must point to a buffer whose size is
in the variable pointed to by blength
. This value is updated.
The option bits are:
PCRE2_CONVERT_UTF Input is UTF PCRE2_CONVERT_NO_UTF_CHECK Do not check UTF validity PCRE2_CONVERT_POSIX_BASIC Convert POSIX basic pattern PCRE2_CONVERT_POSIX_EXTENDED Convert POSIX extended pattern PCRE2_CONVERT_GLOB ) Convert PCRE2_CONVERT_GLOB_NO_WILD_SEPARATOR ) various types PCRE2_CONVERT_GLOB_NO_STARSTAR ) of glob
The return value from pcre2_pattern_convert
() is zero on success
or a non-zero PCRE2 error code.
The pattern conversion functions are described in the pcre2convert(3) documentation.
COPYRIGHT |
---|
This manual page is taken from the PCRE library, which is distributed under the BSD license. |