@@ -2752,42 +2752,62 @@ MATCHING A PATTERN: THE TRADITIONAL FUNCTION
27522752
27532753 The unused bits of the options argument for pcre2_match() must be zero.
27542754 The only bits that may be set are PCRE2_ANCHORED,
2755- PCRE2_COPY_MATCHED_SUBJECT, PCRE2_ENDANCHORED, PCRE2_NOTBOL, PCRE2_NO -
2756- TEOL , PCRE2_NOTEMPTY , PCRE2_NOTEMPTY_ATSTART , PCRE2_NO_JIT ,
2757- PCRE2_NO_UTF_CHECK , PCRE2_PARTIAL_HARD , and PCRE2_PARTIAL_SOFT. Their
2758- action is described below.
2755+ PCRE2_COPY_MATCHED_SUBJECT, PCRE2_DISABLE_RECURSELOOP_CHECK, PCRE2_EN -
2756+ DANCHORED , PCRE2_NOTBOL , PCRE2_NOTEOL , PCRE2_NOTEMPTY ,
2757+ PCRE2_NOTEMPTY_ATSTART , PCRE2_NO_JIT , PCRE2_NO_UTF_CHECK, PCRE2_PAR-
2758+ TIAL_HARD, and PCRE2_PARTIAL_SOFT. Their action is described below.
27592759
27602760 Setting PCRE2_ANCHORED or PCRE2_ENDANCHORED at match time is not sup-
27612761 ported by the just-in-time (JIT) compiler. If it is set, JIT matching
2762- is disabled and the interpretive code in pcre2_match() is run. Apart
2763- from PCRE2_NO_JIT (obviously), the remaining options are supported for
2764- JIT matching.
2762+ is disabled and the interpretive code in pcre2_match() is run.
2763+ PCRE2_DISABLE_RECURSELOOP_CHECK is ignored by JIT, but apart from
2764+ PCRE2_NO_JIT (obviously), the remaining options are supported for JIT
2765+ matching.
27652766
27662767 PCRE2_ANCHORED
27672768
27682769 The PCRE2_ANCHORED option limits pcre2_match() to matching at the first
2769- matching position. If a pattern was compiled with PCRE2_ANCHORED, or
2770- turned out to be anchored by virtue of its contents, it cannot be made
2771- unachored at matching time. Note that setting the option at match time
2770+ matching position. If a pattern was compiled with PCRE2_ANCHORED, or
2771+ turned out to be anchored by virtue of its contents, it cannot be made
2772+ unachored at matching time. Note that setting the option at match time
27722773 disables JIT matching.
27732774
27742775 PCRE2_COPY_MATCHED_SUBJECT
27752776
2776- By default, a pointer to the subject is remembered in the match data
2777- block so that, after a successful match, it can be referenced by the
2778- substring extraction functions. This means that the subject's memory
2779- must not be freed until all such operations are complete. For some ap-
2780- plications where the lifetime of the subject string is not guaranteed,
2781- it may be necessary to make a copy of the subject string, but it is
2782- wasteful to do this unless the match is successful. After a successful
2783- match, if PCRE2_COPY_MATCHED_SUBJECT is set, the subject is copied and
2784- the new pointer is remembered in the match data block instead of the
2785- original subject pointer. The memory allocator that was used for the
2786- match block itself is used. The copy is automatically freed when
2787- pcre2_match_data_free() is called to free the match data block. It is
2777+ By default, a pointer to the subject is remembered in the match data
2778+ block so that, after a successful match, it can be referenced by the
2779+ substring extraction functions. This means that the subject's memory
2780+ must not be freed until all such operations are complete. For some ap-
2781+ plications where the lifetime of the subject string is not guaranteed,
2782+ it may be necessary to make a copy of the subject string, but it is
2783+ wasteful to do this unless the match is successful. After a successful
2784+ match, if PCRE2_COPY_MATCHED_SUBJECT is set, the subject is copied and
2785+ the new pointer is remembered in the match data block instead of the
2786+ original subject pointer. The memory allocator that was used for the
2787+ match block itself is used. The copy is automatically freed when
2788+ pcre2_match_data_free() is called to free the match data block. It is
27882789 also automatically freed if the match data block is re-used for another
27892790 match operation.
27902791
2792+ PCRE2_DISABLE_RECURSELOOP_CHECK
2793+
2794+ This option is relevant only to pcre2_match() for interpretive match-
2795+ ing. It is ignored when JIT is used, and is forbidden for
2796+ pcre2_dfa_match().
2797+
2798+ The use of recursion in patterns can lead to infinite loops. In the in-
2799+ terpretive matcher these would be eventually caught by the match or
2800+ heap limits, but this could take a long time and/or use a lot of memory
2801+ if the limits are large. There is therefore a check at the start of
2802+ each recursion. If the same group is still active from a previous
2803+ call, and the current subject pointer is the same as it was at the
2804+ start of that group, and the furthest inspected character of the sub-
2805+ ject has not changed, an error is generated.
2806+
2807+ There are rare cases of matches that would complete, but nevertheless
2808+ trigger this error. This option disables the check. It is provided
2809+ mainly for testing when comparing JIT and interpretive behaviour.
2810+
27912811 PCRE2_ENDANCHORED
27922812
27932813 If the PCRE2_ENDANCHORED option is set, any string that pcre2_match()
@@ -3978,11 +3998,11 @@ AUTHOR
39783998
39793999REVISION
39804000
3981- Last updated: 19 January 2024
4001+ Last updated: 27 January 2024
39824002 Copyright (c) 1997-2024 University of Cambridge.
39834003
39844004
3985- PCRE2 10.43 19 January 2024 PCRE2API(3)
4005+ PCRE2 10.43 27 January 2024 PCRE2API(3)
39864006------------------------------------------------------------------------------
39874007
39884008
0 commit comments