88 |
<br><a name="SEC3" href="#TOC1">RE-USING A PRECOMPILED PATTERN</a><br> |
<br><a name="SEC3" href="#TOC1">RE-USING A PRECOMPILED PATTERN</a><br> |
89 |
<P> |
<P> |
90 |
Re-using a precompiled pattern is straightforward. Having reloaded it into main |
Re-using a precompiled pattern is straightforward. Having reloaded it into main |
91 |
memory, you pass its pointer to <b>pcre_exec()</b> in the usual way. This should |
memory, you pass its pointer to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b> in |
92 |
work even on another host, and even if that host has the opposite endianness to |
the usual way. This should work even on another host, and even if that host has |
93 |
the one where the pattern was compiled. |
the opposite endianness to the one where the pattern was compiled. |
94 |
</P> |
</P> |
95 |
<P> |
<P> |
96 |
However, if you passed a pointer to custom character tables when the pattern |
However, if you passed a pointer to custom character tables when the pattern |
97 |
was compiled (the <i>tableptr</i> argument of <b>pcre_compile()</b>), you must |
was compiled (the <i>tableptr</i> argument of <b>pcre_compile()</b>), you must |
98 |
now pass a similar pointer to <b>pcre_exec()</b>, because the value saved with |
now pass a similar pointer to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b>, |
99 |
the compiled pattern will obviously be nonsense. A field in a |
because the value saved with the compiled pattern will obviously be nonsense. A |
100 |
<b>pcre_extra()</b> block is used to pass this data, as described in the |
field in a <b>pcre_extra()</b> block is used to pass this data, as described in |
101 |
|
the |
102 |
<a href="pcreapi.html#extradata">section on matching a pattern</a> |
<a href="pcreapi.html#extradata">section on matching a pattern</a> |
103 |
in the |
in the |
104 |
<a href="pcreapi.html"><b>pcreapi</b></a> |
<a href="pcreapi.html"><b>pcreapi</b></a> |
115 |
<b>pcre_extra</b> data block and set the <i>study_data</i> field to point to the |
<b>pcre_extra</b> data block and set the <i>study_data</i> field to point to the |
116 |
reloaded study data. You must also set the PCRE_EXTRA_STUDY_DATA bit in the |
reloaded study data. You must also set the PCRE_EXTRA_STUDY_DATA bit in the |
117 |
<i>flags</i> field to indicate that study data is present. Then pass the |
<i>flags</i> field to indicate that study data is present. Then pass the |
118 |
<b>pcre_extra</b> block to <b>pcre_exec()</b> in the usual way. |
<b>pcre_extra</b> block to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b> in the |
119 |
|
usual way. |
120 |
</P> |
</P> |
121 |
<br><a name="SEC4" href="#TOC1">COMPATIBILITY WITH DIFFERENT PCRE RELEASES</a><br> |
<br><a name="SEC4" href="#TOC1">COMPATIBILITY WITH DIFFERENT PCRE RELEASES</a><br> |
122 |
<P> |
<P> |
123 |
The layout of the control block that is at the start of the data that makes up |
The layout of the control block that is at the start of the data that makes up |
124 |
a compiled pattern was changed for release 5.0. If you have any saved patterns |
a compiled pattern was changed for release 5.0. If you have any saved patterns |
125 |
that were compiled with previous releases (not a facility that was previously |
that were compiled with previous releases (not a facility that was previously |
126 |
advertised), you will have to recompile them for release 5.0. However, from now |
advertised), you will have to recompile them for release 5.0 and above. |
|
on, it should be possible to make changes in a compabible manner. |
|
127 |
</P> |
</P> |
128 |
<P> |
<P> |
129 |
Last updated: 10 September 2004 |
If you have any saved patterns in UTF-8 mode that use \p or \P that were |
130 |
|
compiled with any release up to and including 6.4, you will have to recompile |
131 |
|
them for release 6.5 and above. |
132 |
|
</P> |
133 |
|
<P> |
134 |
|
All saved patterns from earlier releases must be recompiled for release 7.0 or |
135 |
|
higher, because there was an internal reorganization at that release. |
136 |
|
</P> |
137 |
|
<P> |
138 |
|
Last updated: 28 November 2006 |
139 |
<br> |
<br> |
140 |
Copyright © 1997-2004 University of Cambridge. |
Copyright © 1997-2006 University of Cambridge. |
141 |
<p> |
<p> |
142 |
Return to the <a href="index.html">PCRE index page</a>. |
Return to the <a href="index.html">PCRE index page</a>. |
143 |
</p> |
</p> |