• Home
  • Raw
  • Download

Lines Matching full:match

7 In normal use of PCRE2, if there is a match up to the end of a subject string,
8 but more characters are needed to match the entire pattern, PCRE2_ERROR_NOMATCH
9 is returned, just like any other failing match. There are circumstances where
10 it might be helpful to distinguish this "partial match" case.
24 options is whether or not a partial match is preferred to an alternative
25 complete match, though the details differ between the two types of matching
29 as setting a partial match option for the matching function, you must also call
42 This optimization cannot be used for a subject string that might match only
48 .SH "REQUIREMENTS FOR A PARTIAL MATCH"
51 A possible partial match occurs during matching when the end of the subject
53 complete the match, or the addition of more characters might change what is
57 definitely needed to complete a match. In this case both hard and soft matching
58 options yield a partial match.
60 Example 2: if the pattern is /ab+/ and the subject is "ab", a complete match
62 matched. In this case, only PCRE2_PARTIAL_HARD returns a partial match;
63 PCRE2_PARTIAL_SOFT returns the complete match.
66 pattern item is \ez, \eZ, \eb, \eB, or $ there is always a partial match.
77 of the match.
79 (3) There is a special case when the whole pattern can match an empty string.
80 When the starting point is at the end of the subject, the empty string match is
83 might result in a non-empty match, PCRE2_PARTIAL_HARD returns a partial match,
84 which in this case means "there is going to be a match at this point, but until
96 \fBA successful match\fP
97 A complete match has been found, starting and ending within this subject.
100 No match can start anywhere in this subject.
103 Adding more characters may result in a complete match that uses one or more
106 When a partial match is returned, the first two elements in the ovector point
109 for a partial match. Consider this pattern:
113 If it is matched against "456abc123xyz" the result is a complete match, and the
115 match" point. However, if a partial match is requested and the subject string
116 is "456abc12", a partial match is found for the string "abc12", because all
117 these characters are needed for a subsequent re-match with additional
120 If there is more than one partial match, the first one that was found provides
126 fail to match, but the end of the subject is reached during matching, so
128 "123dog" as the first partial match. (In this example, there are two partial
132 .SS "How a partial match is processed by pcre2_match()"
135 What happens when a partial match is identified depends on which of the two
139 partial match is found, without continuing to search for possible complete
140 matches. This option is "hard" because it prefers an earlier partial match over
141 a later complete match. For this reason, the assumption is made that the end of
143 why \ez, \eZ, \eb, \eB, and $ always give a partial match.
145 If PCRE2_PARTIAL_SOFT is set, the partial match is remembered, but matching
147 complete match can be found, PCRE2_ERROR_PARTIAL is returned instead of
148 PCRE2_ERROR_NOMATCH. This option is "soft" because it prefers a complete match
149 over a partial match. All the various matching items in a pattern behave as if
150 the subject string is potentially complete; \ez, \eZ, and $ match at the end of
161 PCRE2_PARTIAL_SOFT, it yields a complete match for "dog". However, if
167 In this case the result is always a complete match because that is found first,
168 and matching never continues after finding a complete match. It might be easier
174 The second pattern will never match "dogsbody", because it will always find the
175 shorter match first.
189 Partial match: 23dec3
191 Partial match: 3ju
193 No match
203 Partial match: 25jun04
207 there is only a partial match.
225 partial match at the end of a segment whenever there is the possibility of
226 changing the match by adding more characters. The PCRE2_NOTBOL option should
229 When a partial match occurs, the next segment must be added to the current
230 subject and the match re-run, using the \fIstartoffset\fP argument of
231 \fBpcre2_match()\fP to begin at the point where the partial match started.
236 Partial match: 23ja
241 Note the use of the \fBoffset\fP modifier to start the new match where the
242 partial match was found. In this example, the next segment was added to the one
243 in which the partial match was found. This is the most straightforward
245 segment. After a partial match, the first half of the buffer is discarded, the
247 before repeating the match as in the example above. After a no match, the
251 partial match before adding the next segment. Unfortunately, this is not at
255 that precede the start of the partial match may have been inspected during the
256 matching process. When \fBpcre2test\fP displays a partial match, it indicates
261 Partial match: 123ab
268 retained in order to get the right match result. If you cannot retain the
292 of a partial match.
296 If PCRE2_PARTIAL_HARD is set, a partial match takes precedence over any
298 partial match was found is set as the first matching string.
307 Whereas the standard function stops as soon as it finds the complete match for
308 "dog", the DFA function also finds the partial match for "dogsbody", and so
315 When a partial match has been found using the DFA matching function, it is
316 possible to continue the match by providing additional subject data and calling
319 because this is where details of the previous partial match are stored. You can
326 Partial match: 23ja
331 second call has "n05" as the subject for the continued (restarted) match.
332 Notice that when the match is complete, only the last part is shown; PCRE2 does
335 if a continued match fails, it is not possible to try again at a new starting
337 match attempt. For example, consider this pattern:
341 If the first part of the subject is "ABC123", a partial match of the first
342 alternative is found at offset 3. There is no partial match for the second
343 alternative, because such a match does not start at the same point in the
345 match because only those alternatives that match at one point in the subject
350 doing it is to retain some or all of the segment and try a new complete match,
352 two buffers. If a partial match at offset \fIn\fP in the first buffer is
353 followed by "no match" when PCRE2_DFA_RESTART is used on the second buffer, you
354 can then try a new match starting at offset \fIn+1\fP in the first buffer.