pcre_compile.3 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. .TH PCRE_COMPILE 3 "01 October 2013" "PCRE 8.34"
  2. .SH NAME
  3. PCRE - Perl-compatible regular expressions
  4. .SH SYNOPSIS
  5. .rs
  6. .sp
  7. .B #include <pcre.h>
  8. .PP
  9. .nf
  10. .B pcre *pcre_compile(const char *\fIpattern\fP, int \fIoptions\fP,
  11. .B " const char **\fIerrptr\fP, int *\fIerroffset\fP,"
  12. .B " const unsigned char *\fItableptr\fP);"
  13. .sp
  14. .B pcre16 *pcre16_compile(PCRE_SPTR16 \fIpattern\fP, int \fIoptions\fP,
  15. .B " const char **\fIerrptr\fP, int *\fIerroffset\fP,"
  16. .B " const unsigned char *\fItableptr\fP);"
  17. .sp
  18. .B pcre32 *pcre32_compile(PCRE_SPTR32 \fIpattern\fP, int \fIoptions\fP,
  19. .B " const char **\fIerrptr\fP, int *\fIerroffset\fP,"
  20. .B " const unsigned char *\fItableptr\fP);"
  21. .fi
  22. .
  23. .SH DESCRIPTION
  24. .rs
  25. .sp
  26. This function compiles a regular expression into an internal form. It is the
  27. same as \fBpcre[16|32]_compile2()\fP, except for the absence of the
  28. \fIerrorcodeptr\fP argument. Its arguments are:
  29. .sp
  30. \fIpattern\fP A zero-terminated string containing the
  31. regular expression to be compiled
  32. \fIoptions\fP Zero or more option bits
  33. \fIerrptr\fP Where to put an error message
  34. \fIerroffset\fP Offset in pattern where error was found
  35. \fItableptr\fP Pointer to character tables, or NULL to
  36. use the built-in default
  37. .sp
  38. The option bits are:
  39. .sp
  40. PCRE_ANCHORED Force pattern anchoring
  41. PCRE_AUTO_CALLOUT Compile automatic callouts
  42. PCRE_BSR_ANYCRLF \eR matches only CR, LF, or CRLF
  43. PCRE_BSR_UNICODE \eR matches all Unicode line endings
  44. PCRE_CASELESS Do caseless matching
  45. PCRE_DOLLAR_ENDONLY $ not to match newline at end
  46. PCRE_DOTALL . matches anything including NL
  47. PCRE_DUPNAMES Allow duplicate names for subpatterns
  48. PCRE_EXTENDED Ignore white space and # comments
  49. PCRE_EXTRA PCRE extra features
  50. (not much use currently)
  51. PCRE_FIRSTLINE Force matching to be before newline
  52. PCRE_JAVASCRIPT_COMPAT JavaScript compatibility
  53. PCRE_MULTILINE ^ and $ match newlines within data
  54. PCRE_NEVER_UTF Lock out UTF, e.g. via (*UTF)
  55. PCRE_NEWLINE_ANY Recognize any Unicode newline sequence
  56. PCRE_NEWLINE_ANYCRLF Recognize CR, LF, and CRLF as newline
  57. sequences
  58. PCRE_NEWLINE_CR Set CR as the newline sequence
  59. PCRE_NEWLINE_CRLF Set CRLF as the newline sequence
  60. PCRE_NEWLINE_LF Set LF as the newline sequence
  61. PCRE_NO_AUTO_CAPTURE Disable numbered capturing paren-
  62. theses (named ones available)
  63. PCRE_NO_AUTO_POSSESS Disable auto-possessification
  64. PCRE_NO_START_OPTIMIZE Disable match-time start optimizations
  65. PCRE_NO_UTF16_CHECK Do not check the pattern for UTF-16
  66. validity (only relevant if
  67. PCRE_UTF16 is set)
  68. PCRE_NO_UTF32_CHECK Do not check the pattern for UTF-32
  69. validity (only relevant if
  70. PCRE_UTF32 is set)
  71. PCRE_NO_UTF8_CHECK Do not check the pattern for UTF-8
  72. validity (only relevant if
  73. PCRE_UTF8 is set)
  74. PCRE_UCP Use Unicode properties for \ed, \ew, etc.
  75. PCRE_UNGREEDY Invert greediness of quantifiers
  76. PCRE_UTF16 Run in \fBpcre16_compile()\fP UTF-16 mode
  77. PCRE_UTF32 Run in \fBpcre32_compile()\fP UTF-32 mode
  78. PCRE_UTF8 Run in \fBpcre_compile()\fP UTF-8 mode
  79. .sp
  80. PCRE must be built with UTF support in order to use PCRE_UTF8/16/32 and
  81. PCRE_NO_UTF8/16/32_CHECK, and with UCP support if PCRE_UCP is used.
  82. .P
  83. The yield of the function is a pointer to a private data structure that
  84. contains the compiled pattern, or NULL if an error was detected. Note that
  85. compiling regular expressions with one version of PCRE for use with a different
  86. version is not guaranteed to work and may cause crashes.
  87. .P
  88. There is a complete description of the PCRE native API in the
  89. .\" HREF
  90. \fBpcreapi\fP
  91. .\"
  92. page and a description of the POSIX API in the
  93. .\" HREF
  94. \fBpcreposix\fP
  95. .\"
  96. page.