1 |
.TH PCRE 3 |
.TH PCREPRECOMPILE 3 |
2 |
.SH NAME |
.SH NAME |
3 |
PCRE - Perl-compatible regular expressions |
PCRE - Perl-compatible regular expressions |
4 |
.SH "SAVING AND RE-USING PRECOMPILED PCRE PATTERNS" |
.SH "SAVING AND RE-USING PRECOMPILED PCRE PATTERNS" |
17 |
If you save compiled patterns to a file, you can copy them to a different host |
If you save compiled patterns to a file, you can copy them to a different host |
18 |
and run them there. This works even if the new host has the opposite endianness |
and run them there. This works even if the new host has the opposite endianness |
19 |
to the one on which the patterns were compiled. There may be a small |
to the one on which the patterns were compiled. There may be a small |
20 |
performance penalty, but it should be insignificant. |
performance penalty, but it should be insignificant. However, compiling regular |
21 |
|
expressions with one version of PCRE for use with a different version is not |
22 |
|
guaranteed to work and may cause crashes. |
23 |
. |
. |
24 |
. |
. |
25 |
.SH "SAVING A COMPILED PATTERN" |
.SH "SAVING A COMPILED PATTERN" |
81 |
.rs |
.rs |
82 |
.sp |
.sp |
83 |
Re-using a precompiled pattern is straightforward. Having reloaded it into main |
Re-using a precompiled pattern is straightforward. Having reloaded it into main |
84 |
memory, you pass its pointer to \fBpcre_exec()\fP in the usual way. This should |
memory, you pass its pointer to \fBpcre_exec()\fP or \fBpcre_dfa_exec()\fP in |
85 |
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 |
86 |
the one where the pattern was compiled. |
the opposite endianness to the one where the pattern was compiled. |
87 |
.P |
.P |
88 |
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 |
89 |
was compiled (the \fItableptr\fP argument of \fBpcre_compile()\fP), you must |
was compiled (the \fItableptr\fP argument of \fBpcre_compile()\fP), you must |
90 |
now pass a similar pointer to \fBpcre_exec()\fP, because the value saved with |
now pass a similar pointer to \fBpcre_exec()\fP or \fBpcre_dfa_exec()\fP, |
91 |
the compiled pattern will obviously be nonsense. A field in a |
because the value saved with the compiled pattern will obviously be nonsense. A |
92 |
\fBpcre_extra()\fP block is used to pass this data, as described in the |
field in a \fBpcre_extra()\fP block is used to pass this data, as described in |
93 |
|
the |
94 |
.\" HTML <a href="pcreapi.html#extradata"> |
.\" HTML <a href="pcreapi.html#extradata"> |
95 |
.\" </a> |
.\" </a> |
96 |
section on matching a pattern |
section on matching a pattern |
110 |
\fBpcre_extra\fP data block and set the \fIstudy_data\fP field to point to the |
\fBpcre_extra\fP data block and set the \fIstudy_data\fP field to point to the |
111 |
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 |
112 |
\fIflags\fP field to indicate that study data is present. Then pass the |
\fIflags\fP field to indicate that study data is present. Then pass the |
113 |
\fBpcre_extra\fP block to \fBpcre_exec()\fP in the usual way. |
\fBpcre_extra\fP block to \fBpcre_exec()\fP or \fBpcre_dfa_exec()\fP in the |
114 |
|
usual way. |
115 |
. |
. |
116 |
. |
. |
117 |
.SH "COMPATIBILITY WITH DIFFERENT PCRE RELEASES" |
.SH "COMPATIBILITY WITH DIFFERENT PCRE RELEASES" |
118 |
.rs |
.rs |
119 |
.sp |
.sp |
120 |
The layout of the control block that is at the start of the data that makes up |
In general, it is safest to recompile all saved patterns when you update to a |
121 |
a compiled pattern was changed for release 5.0. If you have any saved patterns |
new PCRE release, though not all updates actually require this. Recompiling is |
122 |
that were compiled with previous releases (not a facility that was previously |
definitely needed for release 7.2. |
123 |
advertised), you will have to recompile them for release 5.0. However, from now |
. |
124 |
on, it should be possible to make changes in a compabible manner. |
. |
125 |
.P |
. |
126 |
.in 0 |
.SH AUTHOR |
127 |
Last updated: 10 September 2004 |
.rs |
128 |
.br |
.sp |
129 |
Copyright (c) 1997-2004 University of Cambridge. |
.nf |
130 |
|
Philip Hazel |
131 |
|
University Computing Service |
132 |
|
Cambridge CB2 3QH, England. |
133 |
|
.fi |
134 |
|
. |
135 |
|
. |
136 |
|
.SH REVISION |
137 |
|
.rs |
138 |
|
.sp |
139 |
|
.nf |
140 |
|
Last updated: 13 June 2007 |
141 |
|
Copyright (c) 1997-2007 University of Cambridge. |
142 |
|
.fi |