pcre2_pattern_convert.3 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. .TH PCRE2_PATTERN_CONVERT 3 "11 July 2017" "PCRE2 10.30"
  2. .SH NAME
  3. PCRE2 - 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
  18. This function is part of an experimental set of pattern conversion functions.
  19. It converts a foreign pattern (for example, a glob) into a PCRE2 regular
  20. expression 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
  29. The length of the converted pattern (excluding the terminating zero) is
  30. returned via \fIblength\fP. If \fIbuffer\fP is NULL, the function just returns
  31. the output length. If \fIbuffer\fP points to a NULL pointer, heap memory is
  32. obtained for the converted pattern, using the allocator in the context if
  33. present (or else \fBmalloc()\fP), and the field pointed to by \fIbuffer\fP is
  34. updated. If \fIbuffer\fP points to a non-NULL field, that must point to a
  35. buffer whose size is in the variable pointed to by \fIblength\fP. This value is
  36. updated.
  37. .P
  38. The 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
  48. The return value from \fBpcre2_pattern_convert()\fP is zero on success or a
  49. non-zero PCRE2 error code.
  50. .P
  51. The pattern conversion functions are described in the
  52. .\" HREF
  53. \fBpcre2convert\fP
  54. .\"
  55. documentation.