20 |
<li><a name="TOC5" href="#SEC5">CODE VALUE OF NEWLINE</a> |
<li><a name="TOC5" href="#SEC5">CODE VALUE OF NEWLINE</a> |
21 |
<li><a name="TOC6" href="#SEC6">BUILDING SHARED AND STATIC LIBRARIES</a> |
<li><a name="TOC6" href="#SEC6">BUILDING SHARED AND STATIC LIBRARIES</a> |
22 |
<li><a name="TOC7" href="#SEC7">POSIX MALLOC USAGE</a> |
<li><a name="TOC7" href="#SEC7">POSIX MALLOC USAGE</a> |
23 |
<li><a name="TOC8" href="#SEC8">LIMITING PCRE RESOURCE USAGE</a> |
<li><a name="TOC8" href="#SEC8">HANDLING VERY LARGE PATTERNS</a> |
24 |
<li><a name="TOC9" href="#SEC9">HANDLING VERY LARGE PATTERNS</a> |
<li><a name="TOC9" href="#SEC9">AVOIDING EXCESSIVE STACK USAGE</a> |
25 |
<li><a name="TOC10" href="#SEC10">AVOIDING EXCESSIVE STACK USAGE</a> |
<li><a name="TOC10" href="#SEC10">LIMITING PCRE RESOURCE USAGE</a> |
26 |
<li><a name="TOC11" href="#SEC11">USING EBCDIC CODE</a> |
<li><a name="TOC11" href="#SEC11">USING EBCDIC CODE</a> |
27 |
</ul> |
</ul> |
28 |
<br><a name="SEC1" href="#TOC1">PCRE BUILD-TIME OPTIONS</a><br> |
<br><a name="SEC1" href="#TOC1">PCRE BUILD-TIME OPTIONS</a><br> |
85 |
</P> |
</P> |
86 |
<br><a name="SEC5" href="#TOC1">CODE VALUE OF NEWLINE</a><br> |
<br><a name="SEC5" href="#TOC1">CODE VALUE OF NEWLINE</a><br> |
87 |
<P> |
<P> |
88 |
By default, PCRE treats character 10 (linefeed) as the newline character. This |
By default, PCRE interprets character 10 (linefeed, LF) as indicating the end |
89 |
is the normal newline character on Unix-like systems. You can compile PCRE to |
of a line. This is the normal newline character on Unix-like systems. You can |
90 |
use character 13 (carriage return) instead by adding |
compile PCRE to use character 13 (carriage return, CR) instead, by adding |
91 |
<pre> |
<pre> |
92 |
--enable-newline-is-cr |
--enable-newline-is-cr |
93 |
</pre> |
</pre> |
94 |
to the <b>configure</b> command. For completeness there is also a |
to the <b>configure</b> command. There is also a --enable-newline-is-lf option, |
95 |
--enable-newline-is-lf option, which explicitly specifies linefeed as the |
which explicitly specifies linefeed as the newline character. |
96 |
newline character. |
<br> |
97 |
|
<br> |
98 |
|
Alternatively, you can specify that line endings are to be indicated by the two |
99 |
|
character sequence CRLF. If you want this, add |
100 |
|
<pre> |
101 |
|
--enable-newline-is-crlf |
102 |
|
</pre> |
103 |
|
to the <b>configure</b> command. Whatever line ending convention is selected |
104 |
|
when PCRE is built can be overridden when the library functions are called. At |
105 |
|
build time it is conventional to use the standard for your operating system. |
106 |
</P> |
</P> |
107 |
<br><a name="SEC6" href="#TOC1">BUILDING SHARED AND STATIC LIBRARIES</a><br> |
<br><a name="SEC6" href="#TOC1">BUILDING SHARED AND STATIC LIBRARIES</a><br> |
108 |
<P> |
<P> |
130 |
</pre> |
</pre> |
131 |
to the <b>configure</b> command. |
to the <b>configure</b> command. |
132 |
</P> |
</P> |
133 |
<br><a name="SEC8" href="#TOC1">LIMITING PCRE RESOURCE USAGE</a><br> |
<br><a name="SEC8" href="#TOC1">HANDLING VERY LARGE PATTERNS</a><br> |
|
<P> |
|
|
Internally, PCRE has a function called <b>match()</b>, which it calls repeatedly |
|
|
(possibly recursively) when matching a pattern with the <b>pcre_exec()</b> |
|
|
function. By controlling the maximum number of times this function may be |
|
|
called during a single matching operation, a limit can be placed on the |
|
|
resources used by a single call to <b>pcre_exec()</b>. The limit can be changed |
|
|
at run time, as described in the |
|
|
<a href="pcreapi.html"><b>pcreapi</b></a> |
|
|
documentation. The default is 10 million, but this can be changed by adding a |
|
|
setting such as |
|
|
<pre> |
|
|
--with-match-limit=500000 |
|
|
</pre> |
|
|
to the <b>configure</b> command. This setting has no effect on the |
|
|
<b>pcre_dfa_exec()</b> matching function. |
|
|
</P> |
|
|
<br><a name="SEC9" href="#TOC1">HANDLING VERY LARGE PATTERNS</a><br> |
|
134 |
<P> |
<P> |
135 |
Within a compiled pattern, offset values are used to point from one part to |
Within a compiled pattern, offset values are used to point from one part to |
136 |
another (for example, from an opening parenthesis to an alternation |
another (for example, from an opening parenthesis to an alternation |
151 |
using UTF-8) will fail. Part of the output of these tests is a representation |
using UTF-8) will fail. Part of the output of these tests is a representation |
152 |
of the compiled pattern, and this changes with the link size. |
of the compiled pattern, and this changes with the link size. |
153 |
</P> |
</P> |
154 |
<br><a name="SEC10" href="#TOC1">AVOIDING EXCESSIVE STACK USAGE</a><br> |
<br><a name="SEC9" href="#TOC1">AVOIDING EXCESSIVE STACK USAGE</a><br> |
155 |
<P> |
<P> |
156 |
When matching with the <b>pcre_exec()</b> function, PCRE implements backtracking |
When matching with the <b>pcre_exec()</b> function, PCRE implements backtracking |
157 |
by making recursive calls to an internal function called <b>match()</b>. In |
by making recursive calls to an internal function called <b>match()</b>. In |
158 |
environments where the size of the stack is limited, this can severely limit |
environments where the size of the stack is limited, this can severely limit |
159 |
PCRE's operation. (The Unix environment does not usually suffer from this |
PCRE's operation. (The Unix environment does not usually suffer from this |
160 |
problem.) An alternative approach that uses memory from the heap to remember |
problem, but it may sometimes be necessary to increase the maximum stack size. |
161 |
data, instead of using recursive function calls, has been implemented to work |
There is a discussion in the |
162 |
round this problem. If you want to build a version of PCRE that works this way, |
<a href="pcrestack.html"><b>pcrestack</b></a> |
163 |
add |
documentation.) An alternative approach to recursion that uses memory from the |
164 |
|
heap to remember data, instead of using recursive function calls, has been |
165 |
|
implemented to work round the problem of limited stack size. If you want to |
166 |
|
build a version of PCRE that works this way, add |
167 |
<pre> |
<pre> |
168 |
--disable-stack-for-recursion |
--disable-stack-for-recursion |
169 |
</pre> |
</pre> |
177 |
way. This option affects only the <b>pcre_exec()</b> function; it is not |
way. This option affects only the <b>pcre_exec()</b> function; it is not |
178 |
relevant for the the <b>pcre_dfa_exec()</b> function. |
relevant for the the <b>pcre_dfa_exec()</b> function. |
179 |
</P> |
</P> |
180 |
|
<br><a name="SEC10" href="#TOC1">LIMITING PCRE RESOURCE USAGE</a><br> |
181 |
|
<P> |
182 |
|
Internally, PCRE has a function called <b>match()</b>, which it calls repeatedly |
183 |
|
(sometimes recursively) when matching a pattern with the <b>pcre_exec()</b> |
184 |
|
function. By controlling the maximum number of times this function may be |
185 |
|
called during a single matching operation, a limit can be placed on the |
186 |
|
resources used by a single call to <b>pcre_exec()</b>. The limit can be changed |
187 |
|
at run time, as described in the |
188 |
|
<a href="pcreapi.html"><b>pcreapi</b></a> |
189 |
|
documentation. The default is 10 million, but this can be changed by adding a |
190 |
|
setting such as |
191 |
|
<pre> |
192 |
|
--with-match-limit=500000 |
193 |
|
</pre> |
194 |
|
to the <b>configure</b> command. This setting has no effect on the |
195 |
|
<b>pcre_dfa_exec()</b> matching function. |
196 |
|
</P> |
197 |
|
<P> |
198 |
|
In some environments it is desirable to limit the depth of recursive calls of |
199 |
|
<b>match()</b> more strictly than the total number of calls, in order to |
200 |
|
restrict the maximum amount of stack (or heap, if --disable-stack-for-recursion |
201 |
|
is specified) that is used. A second limit controls this; it defaults to the |
202 |
|
value that is set for --with-match-limit, which imposes no additional |
203 |
|
constraints. However, you can set a lower limit by adding, for example, |
204 |
|
<pre> |
205 |
|
--with-match-limit-recursion=10000 |
206 |
|
</pre> |
207 |
|
to the <b>configure</b> command. This value can also be overridden at run time. |
208 |
|
</P> |
209 |
<br><a name="SEC11" href="#TOC1">USING EBCDIC CODE</a><br> |
<br><a name="SEC11" href="#TOC1">USING EBCDIC CODE</a><br> |
210 |
<P> |
<P> |
211 |
PCRE assumes by default that it will run in an environment where the character |
PCRE assumes by default that it will run in an environment where the character |
217 |
to the <b>configure</b> command. |
to the <b>configure</b> command. |
218 |
</P> |
</P> |
219 |
<P> |
<P> |
220 |
Last updated: 15 August 2005 |
Last updated: 06 June 2006 |
221 |
<br> |
<br> |
222 |
Copyright © 1997-2005 University of Cambridge. |
Copyright © 1997-2006 University of Cambridge. |
223 |
<p> |
<p> |
224 |
Return to the <a href="index.html">PCRE index page</a>. |
Return to the <a href="index.html">PCRE index page</a>. |
225 |
</p> |
</p> |