github的一些开源项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 lines
3.7 KiB

  1. <html>
  2. <head>
  3. <title>pcre2_match specification</title>
  4. </head>
  5. <body bgcolor="#FFFFFF" text="#00005A" link="#0066FF" alink="#3399FF" vlink="#2222BB">
  6. <h1>pcre2_match man page</h1>
  7. <p>
  8. Return to the <a href="index.html">PCRE2 index page</a>.
  9. </p>
  10. <p>
  11. This page is part of the PCRE2 HTML documentation. It was generated
  12. automatically from the original man page. If there is any nonsense in it,
  13. please consult the man page, in case the conversion went wrong.
  14. <br>
  15. <br><b>
  16. SYNOPSIS
  17. </b><br>
  18. <P>
  19. <b>#include &#60;pcre2.h&#62;</b>
  20. </P>
  21. <P>
  22. <b>int pcre2_match(const pcre2_code *<i>code</i>, PCRE2_SPTR <i>subject</i>,</b>
  23. <b> PCRE2_SIZE <i>length</i>, PCRE2_SIZE <i>startoffset</i>,</b>
  24. <b> uint32_t <i>options</i>, pcre2_match_data *<i>match_data</i>,</b>
  25. <b> pcre2_match_context *<i>mcontext</i>);</b>
  26. </P>
  27. <br><b>
  28. DESCRIPTION
  29. </b><br>
  30. <P>
  31. This function matches a compiled regular expression against a given subject
  32. string, using a matching algorithm that is similar to Perl's. It returns
  33. offsets to what it has matched and to captured substrings via the
  34. <b>match_data</b> block, which can be processed by functions with names that
  35. start with <b>pcre2_get_ovector_...()</b> or <b>pcre2_substring_...()</b>. The
  36. return from <b>pcre2_match()</b> is one more than the highest numbered capturing
  37. pair that has been set (for example, 1 if there are no captures), zero if the
  38. vector of offsets is too small, or a negative error code for no match and other
  39. errors. The function arguments are:
  40. <pre>
  41. <i>code</i> Points to the compiled pattern
  42. <i>subject</i> Points to the subject string
  43. <i>length</i> Length of the subject string
  44. <i>startoffset</i> Offset in the subject at which to start matching
  45. <i>options</i> Option bits
  46. <i>match_data</i> Points to a match data block, for results
  47. <i>mcontext</i> Points to a match context, or is NULL
  48. </pre>
  49. A match context is needed only if you want to:
  50. <pre>
  51. Set up a callout function
  52. Set a matching offset limit
  53. Change the heap memory limit
  54. Change the backtracking match limit
  55. Change the backtracking depth limit
  56. Set custom memory management specifically for the match
  57. </pre>
  58. The <i>length</i> and <i>startoffset</i> values are code units, not characters.
  59. The length may be given as PCRE2_ZERO_TERMINATED for a subject that is
  60. terminated by a binary zero code unit. The options are:
  61. <pre>
  62. PCRE2_ANCHORED Match only at the first position
  63. PCRE2_COPY_MATCHED_SUBJECT
  64. On success, make a private subject copy
  65. PCRE2_DISABLE_RECURSELOOP_CHECK
  66. Only useful in rare cases; use with care
  67. PCRE2_ENDANCHORED Pattern can match only at end of subject
  68. PCRE2_NOTBOL Subject string is not the beginning of a line
  69. PCRE2_NOTEOL Subject string is not the end of a line
  70. PCRE2_NOTEMPTY An empty string is not a valid match
  71. PCRE2_NOTEMPTY_ATSTART An empty string at the start of the subject is not a valid match
  72. PCRE2_NO_JIT Do not use JIT matching
  73. PCRE2_NO_UTF_CHECK Do not check the subject for UTF validity (only relevant if PCRE2_UTF
  74. was set at compile time)
  75. PCRE2_PARTIAL_HARD Return PCRE2_ERROR_PARTIAL for a partial match even if there is a full match
  76. PCRE2_PARTIAL_SOFT Return PCRE2_ERROR_PARTIAL for a partial match if no full matches are found
  77. </pre>
  78. For details of partial matching, see the
  79. <a href="pcre2partial.html"><b>pcre2partial</b></a>
  80. page. There is a complete description of the PCRE2 native API in the
  81. <a href="pcre2api.html"><b>pcre2api</b></a>
  82. page and a description of the POSIX API in the
  83. <a href="pcre2posix.html"><b>pcre2posix</b></a>
  84. page.
  85. <p>
  86. Return to the <a href="index.html">PCRE2 index page</a>.
  87. </p>