pcre_exec.3 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. .TH PCRE_EXEC 3 "12 May 2013" "PCRE 8.33"
  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 int pcre_exec(const pcre *\fIcode\fP, "const pcre_extra *\fIextra\fP,"
  11. .B " const char *\fIsubject\fP, int \fIlength\fP, int \fIstartoffset\fP,"
  12. .B " int \fIoptions\fP, int *\fIovector\fP, int \fIovecsize\fP);"
  13. .sp
  14. .B int pcre16_exec(const pcre16 *\fIcode\fP, "const pcre16_extra *\fIextra\fP,"
  15. .B " PCRE_SPTR16 \fIsubject\fP, int \fIlength\fP, int \fIstartoffset\fP,"
  16. .B " int \fIoptions\fP, int *\fIovector\fP, int \fIovecsize\fP);"
  17. .sp
  18. .B int pcre32_exec(const pcre32 *\fIcode\fP, "const pcre32_extra *\fIextra\fP,"
  19. .B " PCRE_SPTR32 \fIsubject\fP, int \fIlength\fP, int \fIstartoffset\fP,"
  20. .B " int \fIoptions\fP, int *\fIovector\fP, int \fIovecsize\fP);"
  21. .fi
  22. .
  23. .SH DESCRIPTION
  24. .rs
  25. .sp
  26. This function matches a compiled regular expression against a given subject
  27. string, using a matching algorithm that is similar to Perl's. It returns
  28. offsets to captured substrings. Its arguments are:
  29. .sp
  30. \fIcode\fP Points to the compiled pattern
  31. \fIextra\fP Points to an associated \fBpcre[16|32]_extra\fP structure,
  32. or is NULL
  33. \fIsubject\fP Points to the subject string
  34. \fIlength\fP Length of the subject string
  35. \fIstartoffset\fP Offset in the subject at which to start matching
  36. \fIoptions\fP Option bits
  37. \fIovector\fP Points to a vector of ints for result offsets
  38. \fIovecsize\fP Number of elements in the vector (a multiple of 3)
  39. .sp
  40. The units for \fIlength\fP and \fIstartoffset\fP are bytes for
  41. \fBpcre_exec()\fP, 16-bit data items for \fBpcre16_exec()\fP, and 32-bit items
  42. for \fBpcre32_exec()\fP. The options are:
  43. .sp
  44. PCRE_ANCHORED Match only at the first position
  45. PCRE_BSR_ANYCRLF \eR matches only CR, LF, or CRLF
  46. PCRE_BSR_UNICODE \eR matches all Unicode line endings
  47. PCRE_NEWLINE_ANY Recognize any Unicode newline sequence
  48. PCRE_NEWLINE_ANYCRLF Recognize CR, LF, & CRLF as newline sequences
  49. PCRE_NEWLINE_CR Recognize CR as the only newline sequence
  50. PCRE_NEWLINE_CRLF Recognize CRLF as the only newline sequence
  51. PCRE_NEWLINE_LF Recognize LF as the only newline sequence
  52. PCRE_NOTBOL Subject string is not the beginning of a line
  53. PCRE_NOTEOL Subject string is not the end of a line
  54. PCRE_NOTEMPTY An empty string is not a valid match
  55. PCRE_NOTEMPTY_ATSTART An empty string at the start of the subject
  56. is not a valid match
  57. PCRE_NO_START_OPTIMIZE Do not do "start-match" optimizations
  58. PCRE_NO_UTF16_CHECK Do not check the subject for UTF-16
  59. validity (only relevant if PCRE_UTF16
  60. was set at compile time)
  61. PCRE_NO_UTF32_CHECK Do not check the subject for UTF-32
  62. validity (only relevant if PCRE_UTF32
  63. was set at compile time)
  64. PCRE_NO_UTF8_CHECK Do not check the subject for UTF-8
  65. validity (only relevant if PCRE_UTF8
  66. was set at compile time)
  67. PCRE_PARTIAL ) Return PCRE_ERROR_PARTIAL for a partial
  68. PCRE_PARTIAL_SOFT ) match if no full matches are found
  69. PCRE_PARTIAL_HARD Return PCRE_ERROR_PARTIAL for a partial match
  70. if that is found before a full match
  71. .sp
  72. For details of partial matching, see the
  73. .\" HREF
  74. \fBpcrepartial\fP
  75. .\"
  76. page. A \fBpcre_extra\fP structure contains the following fields:
  77. .sp
  78. \fIflags\fP Bits indicating which fields are set
  79. \fIstudy_data\fP Opaque data from \fBpcre[16|32]_study()\fP
  80. \fImatch_limit\fP Limit on internal resource use
  81. \fImatch_limit_recursion\fP Limit on internal recursion depth
  82. \fIcallout_data\fP Opaque data passed back to callouts
  83. \fItables\fP Points to character tables or is NULL
  84. \fImark\fP For passing back a *MARK pointer
  85. \fIexecutable_jit\fP Opaque data from JIT compilation
  86. .sp
  87. The flag bits are PCRE_EXTRA_STUDY_DATA, PCRE_EXTRA_MATCH_LIMIT,
  88. PCRE_EXTRA_MATCH_LIMIT_RECURSION, PCRE_EXTRA_CALLOUT_DATA,
  89. PCRE_EXTRA_TABLES, PCRE_EXTRA_MARK and PCRE_EXTRA_EXECUTABLE_JIT.
  90. .P
  91. There is a complete description of the PCRE native API in the
  92. .\" HREF
  93. \fBpcreapi\fP
  94. .\"
  95. page and a description of the POSIX API in the
  96. .\" HREF
  97. \fBpcreposix\fP
  98. .\"
  99. page.