blob: b72acb76b58718e218fc1c81382baff3e936b440 [file] [log] [blame]
Elliott Hughes9bc971b2018-07-27 13:23:14 -07001.TH PCRE2_PATTERN_CONVERT 3 "11 July 2017" "PCRE2 10.30"
2.SH NAME
3PCRE2 - Perl-compatible regular expressions (revised API)
4.SH SYNOPSIS
5.rs
6.sp
7.B #include <pcre2.h>
8.PP
9.nf
10.B int pcre2_pattern_convert(PCRE2_SPTR \fIpattern\fP, PCRE2_SIZE \fIlength\fP,
11.B " uint32_t \fIoptions\fP, PCRE2_UCHAR **\fIbuffer\fP,"
12.B " PCRE2_SIZE *\fIblength\fP, pcre2_convert_context *\fIcvcontext\fP);"
13.fi
14.
15.SH DESCRIPTION
16.rs
17.sp
18This function is part of an experimental set of pattern conversion functions.
19It converts a foreign pattern (for example, a glob) into a PCRE2 regular
20expression pattern. Its arguments are:
21.sp
22 \fIpattern\fP The foreign pattern
23 \fIlength\fP The length of the input pattern or PCRE2_ZERO_TERMINATED
24 \fIoptions\fP Option bits
25 \fIbuffer\fP Pointer to pointer to output buffer, or NULL
26 \fIblength\fP Pointer to output length field
27 \fIcvcontext\fP Pointer to a convert context or NULL
28.sp
29The length of the converted pattern (excluding the terminating zero) is
30returned via \fIblength\fP. If \fIbuffer\fP is NULL, the function just returns
31the output length. If \fIbuffer\fP points to a NULL pointer, heap memory is
32obtained for the converted pattern, using the allocator in the context if
33present (or else \fBmalloc()\fP), and the field pointed to by \fIbuffer\fP is
34updated. If \fIbuffer\fP points to a non-NULL field, that must point to a
35buffer whose size is in the variable pointed to by \fIblength\fP. This value is
36updated.
37.P
38The option bits are:
39.sp
40 PCRE2_CONVERT_UTF Input is UTF
41 PCRE2_CONVERT_NO_UTF_CHECK Do not check UTF validity
42 PCRE2_CONVERT_POSIX_BASIC Convert POSIX basic pattern
43 PCRE2_CONVERT_POSIX_EXTENDED Convert POSIX extended pattern
44 PCRE2_CONVERT_GLOB ) Convert
45 PCRE2_CONVERT_GLOB_NO_WILD_SEPARATOR ) various types
46 PCRE2_CONVERT_GLOB_NO_STARSTAR ) of glob
47.sp
48The return value from \fBpcre2_pattern_convert()\fP is zero on success or a
49non-zero PCRE2 error code.
50.P
51The pattern conversion functions are described in the
52.\" HREF
53\fBpcre2convert\fP
54.\"
55documentation.