Skip to content

Commit d58d2e2

Browse files
Sync autogenerated files #noupdate
1 parent 87ce2fc commit d58d2e2

File tree

4 files changed

+25
-13
lines changed

4 files changed

+25
-13
lines changed

doc/html/pcre2demo.html

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ <h2>
9393

9494
int crlf_is_newline;
9595
int errornumber;
96-
int find_all;
96+
int find_all, caseless_match;
9797
int i;
9898
int rc;
9999
int utf8;
@@ -111,16 +111,21 @@ <h2>
111111

112112

113113
/**************************************************************************
114-
* First, sort out the command line. There is only one possible option at *
115-
* the moment, "-g" to request repeated matching to find all occurrences, *
116-
* like Perl's /g option. We set the variable find_all to a non-zero value *
117-
* if the -g option is present. *
114+
* First, sort out the command line. Options: *
115+
* - "-g" to request repeated matching to find all occurrences, *
116+
* like Perl's /g option. We set the variable find_all to a non-zero *
117+
* value if the -g option is present. *
118+
* - "-i" to request caseless matching, like Perl's /i option. We set the *
119+
* variable caseless_match to PCRE2_CASELESS if the -i option is *
120+
* present. *
118121
**************************************************************************/
119122

120123
find_all = 0;
124+
caseless_match = 0;
121125
for (i = 1; i &lt; argc; i++)
122126
{
123127
if (strcmp(argv[i], "-g") == 0) find_all = 1;
128+
else if (strcmp(argv[i], "-i") == 0) caseless_match = PCRE2_CASELESS;
124129
else if (argv[i][0] == '-')
125130
{
126131
printf("Unrecognised option %s\n", argv[i]);
@@ -156,7 +161,7 @@ <h2>
156161
re = pcre2_compile(
157162
pattern, /* the pattern */
158163
PCRE2_ZERO_TERMINATED, /* indicates pattern is zero-terminated */
159-
0, /* default options */
164+
caseless_match, /* possibly enable caseless */
160165
&amp;errornumber, /* for error number */
161166
&amp;erroroffset, /* for error offset */
162167
NULL); /* use default compile context */

doc/html/pcre2sample.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ <h2>
6262
<pre>
6363
./pcre2demo 'cat|dog' 'the cat sat on the mat'
6464
./pcre2demo -g 'cat|dog' 'the dog sat on the cat'
65+
./pcre2demo -i 'cat' 'the dog sat on the CAT'
6566
</pre>
6667
Note that there is a much more comprehensive test program, called
6768
<a href="pcre2test.html"><b>pcre2test</b>,</a>

doc/pcre2.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11285,6 +11285,7 @@ PCRE2 SAMPLE PROGRAM
1128511285

1128611286
./pcre2demo 'cat|dog' 'the cat sat on the mat'
1128711287
./pcre2demo -g 'cat|dog' 'the dog sat on the cat'
11288+
./pcre2demo -i 'cat' 'the dog sat on the CAT'
1128811289

1128911290
Note that there is a much more comprehensive test program, called
1129011291
pcre2test, which supports many more facilities for testing regular ex-

doc/pcre2demo.3

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.TH PCRE2DEMO 3 "31 August 2021" "PCRE2 10.46-DEV"
1+
.TH PCRE2DEMO 3 "28 February 2025" "PCRE2 10.46-DEV"
22
.\"AUTOMATICALLY GENERATED BY UpdateAlways - do not EDIT!
33
.SH NAME
44
PCRE2DEMO - A demonstration C program for PCRE2
@@ -103,7 +103,7 @@ PCRE2_SPTR name_table;
103103
104104
int crlf_is_newline;
105105
int errornumber;
106-
int find_all;
106+
int find_all, caseless_match;
107107
int i;
108108
int rc;
109109
int utf8;
@@ -121,16 +121,21 @@ pcre2_match_data *match_data;
121121
122122
123123
/**************************************************************************
124-
* First, sort out the command line. There is only one possible option at *
125-
* the moment, "-g" to request repeated matching to find all occurrences, *
126-
* like Perl's /g option. We set the variable find_all to a non-zero value *
127-
* if the -g option is present. *
124+
* First, sort out the command line. Options: *
125+
* - "-g" to request repeated matching to find all occurrences, *
126+
* like Perl's /g option. We set the variable find_all to a non-zero *
127+
* value if the -g option is present. *
128+
* - "-i" to request caseless matching, like Perl's /i option. We set the *
129+
* variable caseless_match to PCRE2_CASELESS if the -i option is *
130+
* present. *
128131
**************************************************************************/
129132
130133
find_all = 0;
134+
caseless_match = 0;
131135
for (i = 1; i < argc; i++)
132136
{
133137
if (strcmp(argv[i], "-g") == 0) find_all = 1;
138+
else if (strcmp(argv[i], "-i") == 0) caseless_match = PCRE2_CASELESS;
134139
else if (argv[i][0] == '-')
135140
{
136141
printf("Unrecognised option %s\en", argv[i]);
@@ -166,7 +171,7 @@ subject_length = (PCRE2_SIZE)strlen((char *)subject);
166171
re = pcre2_compile(
167172
pattern, /* the pattern */
168173
PCRE2_ZERO_TERMINATED, /* indicates pattern is zero-terminated */
169-
0, /* default options */
174+
caseless_match, /* possibly enable caseless */
170175
&errornumber, /* for error number */
171176
&erroroffset, /* for error offset */
172177
NULL); /* use default compile context */

0 commit comments

Comments
 (0)