@@ -2752,42 +2752,62 @@ MATCHING A PATTERN: THE TRADITIONAL FUNCTION
2752
2752
2753
2753
The unused bits of the options argument for pcre2_match() must be zero.
2754
2754
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.
2759
2759
2760
2760
Setting PCRE2_ANCHORED or PCRE2_ENDANCHORED at match time is not sup-
2761
2761
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.
2765
2766
2766
2767
PCRE2_ANCHORED
2767
2768
2768
2769
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
2772
2773
disables JIT matching.
2773
2774
2774
2775
PCRE2_COPY_MATCHED_SUBJECT
2775
2776
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
2788
2789
also automatically freed if the match data block is re-used for another
2789
2790
match operation.
2790
2791
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
+
2791
2811
PCRE2_ENDANCHORED
2792
2812
2793
2813
If the PCRE2_ENDANCHORED option is set, any string that pcre2_match()
@@ -3978,11 +3998,11 @@ AUTHOR
3978
3998
3979
3999
REVISION
3980
4000
3981
- Last updated: 19 January 2024
4001
+ Last updated: 27 January 2024
3982
4002
Copyright (c) 1997-2024 University of Cambridge.
3983
4003
3984
4004
3985
- PCRE2 10.43 19 January 2024 PCRE2API(3)
4005
+ PCRE2 10.43 27 January 2024 PCRE2API(3)
3986
4006
------------------------------------------------------------------------------
3987
4007
3988
4008
0 commit comments