Lines Matching full:match
17 <li><a name="TOC2" href="#SEC2">REQUIREMENTS FOR A PARTIAL MATCH</a>
27 In normal use of PCRE2, if there is a match up to the end of a subject string,
28 but more characters are needed to match the entire pattern, PCRE2_ERROR_NOMATCH
29 is returned, just like any other failing match. There are circumstances where
30 it might be helpful to distinguish this "partial match" case.
47 options is whether or not a partial match is preferred to an alternative
48 complete match, though the details differ between the two types of matching
53 as setting a partial match option for the matching function, you must also call
67 This optimization cannot be used for a subject string that might match only
72 <br><a name="SEC2" href="#TOC1">REQUIREMENTS FOR A PARTIAL MATCH</a><br>
74 A possible partial match occurs during matching when the end of the subject
76 complete the match, or the addition of more characters might change what is
81 definitely needed to complete a match. In this case both hard and soft matching
82 options yield a partial match.
85 Example 2: if the pattern is /ab+/ and the subject is "ab", a complete match
87 matched. In this case, only PCRE2_PARTIAL_HARD returns a partial match;
88 PCRE2_PARTIAL_SOFT returns the complete match.
92 pattern item is \z, \Z, \b, \B, or $ there is always a partial match.
105 of the match.
108 (3) There is a special case when the whole pattern can match an empty string.
109 When the starting point is at the end of the subject, the empty string match is
112 might result in a non-empty match, PCRE2_PARTIAL_HARD returns a partial match,
113 which in this case means "there is going to be a match at this point, but until
123 <b>A successful match</b>
124 A complete match has been found, starting and ending within this subject.
128 No match can start anywhere in this subject.
132 Adding more characters may result in a complete match that uses one or more
136 When a partial match is returned, the first two elements in the ovector point
139 for a partial match. Consider this pattern:
143 If it is matched against "456abc123xyz" the result is a complete match, and the
145 match" point. However, if a partial match is requested and the subject string
146 is "456abc12", a partial match is found for the string "abc12", because all
147 these characters are needed for a subsequent re-match with additional
151 If there is more than one partial match, the first one that was found provides
157 fail to match, but the end of the subject is reached during matching, so
159 "123dog" as the first partial match. (In this example, there are two partial
163 How a partial match is processed by pcre2_match()
166 What happens when a partial match is identified depends on which of the two
171 partial match is found, without continuing to search for possible complete
172 matches. This option is "hard" because it prefers an earlier partial match over
173 a later complete match. For this reason, the assumption is made that the end of
175 why \z, \Z, \b, \B, and $ always give a partial match.
178 If PCRE2_PARTIAL_SOFT is set, the partial match is remembered, but matching
180 complete match can be found, PCRE2_ERROR_PARTIAL is returned instead of
181 PCRE2_ERROR_NOMATCH. This option is "soft" because it prefers a complete match
182 over a partial match. All the various matching items in a pattern behave as if
183 the subject string is potentially complete; \z, \Z, and $ match at the end of
195 PCRE2_PARTIAL_SOFT, it yields a complete match for "dog". However, if
201 In this case the result is always a complete match because that is found first,
202 and matching never continues after finding a complete match. It might be easier
208 The second pattern will never match "dogsbody", because it will always find the
209 shorter match first.
223 Partial match: 23dec3
225 Partial match: 3ju
227 No match
237 Partial match: 25jun04
241 there is only a partial match.
257 partial match at the end of a segment whenever there is the possibility of
258 changing the match by adding more characters. The PCRE2_NOTBOL option should
262 When a partial match occurs, the next segment must be added to the current
263 subject and the match re-run, using the <i>startoffset</i> argument of
264 <b>pcre2_match()</b> to begin at the point where the partial match started.
269 Partial match: 23ja
274 Note the use of the <b>offset</b> modifier to start the new match where the
275 partial match was found. In this example, the next segment was added to the one
276 in which the partial match was found. This is the most straightforward
278 segment. After a partial match, the first half of the buffer is discarded, the
280 before repeating the match as in the example above. After a no match, the
285 partial match before adding the next segment. Unfortunately, this is not at
289 that precede the start of the partial match may have been inspected during the
290 matching process. When <b>pcre2test</b> displays a partial match, it indicates
295 Partial match: 123ab
302 retained in order to get the right match result. If you cannot retain the
326 of a partial match.
331 If PCRE2_PARTIAL_HARD is set, a partial match takes precedence over any
333 partial match was found is set as the first matching string.
343 Whereas the standard function stops as soon as it finds the complete match for
344 "dog", the DFA function also finds the partial match for "dogsbody", and so
349 When a partial match has been found using the DFA matching function, it is
350 possible to continue the match by providing additional subject data and calling
353 because this is where details of the previous partial match are stored. You can
360 Partial match: 23ja
365 second call has "n05" as the subject for the continued (restarted) match.
366 Notice that when the match is complete, only the last part is shown; PCRE2 does
369 if a continued match fails, it is not possible to try again at a new starting
371 match attempt. For example, consider this pattern:
375 If the first part of the subject is "ABC123", a partial match of the first
376 alternative is found at offset 3. There is no partial match for the second
377 alternative, because such a match does not start at the same point in the
379 match because only those alternatives that match at one point in the subject
385 doing it is to retain some or all of the segment and try a new complete match,
387 two buffers. If a partial match at offset <i>n</i> in the first buffer is
388 followed by "no match" when PCRE2_DFA_RESTART is used on the second buffer, you
389 can then try a new match starting at offset <i>n+1</i> in the first buffer.