| 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> |
| 127 |
on, it should be possible to make changes in a compabible manner. |
on, it should be possible to make changes in a compabible manner. |
| 128 |
</P> |
</P> |
| 129 |
<P> |
<P> |
| 130 |
Last updated: 10 September 2004 |
Last updated: 28 February 2005 |
| 131 |
<br> |
<br> |
| 132 |
Copyright © 1997-2004 University of Cambridge. |
Copyright © 1997-2005 University of Cambridge. |
| 133 |
<p> |
<p> |
| 134 |
Return to the <a href="index.html">PCRE index page</a>. |
Return to the <a href="index.html">PCRE index page</a>. |
| 135 |
</p> |
</p> |