102 |
<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> |
103 |
<P> |
<P> |
104 |
Re-using a precompiled pattern is straightforward. Having reloaded it into main |
Re-using a precompiled pattern is straightforward. Having reloaded it into main |
105 |
memory, called <b>pcre[16|32]_pattern_to_host_byte_order()</b> if necessary, |
memory, called <b>pcre[16|32]_pattern_to_host_byte_order()</b> if necessary, you |
106 |
you pass its pointer to <b>pcre[16|32]_exec()</b> or <b>pcre[16|32]_dfa_exec()</b> in |
pass its pointer to <b>pcre[16|32]_exec()</b> or <b>pcre[16|32]_dfa_exec()</b> in |
107 |
the usual way. |
the usual way. |
108 |
</P> |
</P> |
109 |
<P> |
<P> |
119 |
documentation. |
documentation. |
120 |
</P> |
</P> |
121 |
<P> |
<P> |
122 |
|
<b>Warning:</b> The tables that <b>pcre_exec()</b> and <b>pcre_dfa_exec()</b> use |
123 |
|
must be the same as those that were used when the pattern was compiled. If this |
124 |
|
is not the case, the behaviour is undefined. |
125 |
|
</P> |
126 |
|
<P> |
127 |
If you did not provide custom character tables when the pattern was compiled, |
If you did not provide custom character tables when the pattern was compiled, |
128 |
the pointer in the compiled pattern is NULL, which causes the matching |
the pointer in the compiled pattern is NULL, which causes the matching |
129 |
functions to use PCRE's internal tables. Thus, you do not need to take any |
functions to use PCRE's internal tables. Thus, you do not need to take any |
131 |
</P> |
</P> |
132 |
<P> |
<P> |
133 |
If you saved study data with the compiled pattern, you need to create your own |
If you saved study data with the compiled pattern, you need to create your own |
134 |
<b>pcre[16|32]_extra</b> data block and set the <i>study_data</i> field to point to the |
<b>pcre[16|32]_extra</b> data block and set the <i>study_data</i> field to point |
135 |
reloaded study data. You must also set the PCRE_EXTRA_STUDY_DATA bit in the |
to the reloaded study data. You must also set the PCRE_EXTRA_STUDY_DATA bit in |
136 |
<i>flags</i> field to indicate that study data is present. Then pass the |
the <i>flags</i> field to indicate that study data is present. Then pass the |
137 |
<b>pcre[16|32]_extra</b> block to the matching function in the usual way. If the |
<b>pcre[16|32]_extra</b> block to the matching function in the usual way. If the |
138 |
pattern was studied for just-in-time optimization, that data cannot be saved, |
pattern was studied for just-in-time optimization, that data cannot be saved, |
139 |
and so is lost by a save/restore cycle. |
and so is lost by a save/restore cycle. |
154 |
</P> |
</P> |
155 |
<br><a name="SEC6" href="#TOC1">REVISION</a><br> |
<br><a name="SEC6" href="#TOC1">REVISION</a><br> |
156 |
<P> |
<P> |
157 |
Last updated: 24 June 2012 |
Last updated: 12 November 2013 |
158 |
<br> |
<br> |
159 |
Copyright © 1997-2012 University of Cambridge. |
Copyright © 1997-2013 University of Cambridge. |
160 |
<br> |
<br> |
161 |
<p> |
<p> |
162 |
Return to the <a href="index.html">PCRE index page</a>. |
Return to the <a href="index.html">PCRE index page</a>. |