869 |
a Perl-compatible manner. A sample program that demonstrates the sim- |
a Perl-compatible manner. A sample program that demonstrates the sim- |
870 |
plest way of using them is provided in the file called pcredemo.c in |
plest way of using them is provided in the file called pcredemo.c in |
871 |
the source distribution. The pcresample documentation describes how to |
the source distribution. The pcresample documentation describes how to |
872 |
run it. |
compile and run it. |
873 |
|
|
874 |
A second matching function, pcre_dfa_exec(), which is not Perl-compati- |
A second matching function, pcre_dfa_exec(), which is not Perl-compati- |
875 |
ble, is also provided. This uses a different algorithm for the match- |
ble, is also provided. This uses a different algorithm for the match- |
2565 |
|
|
2566 |
REVISION |
REVISION |
2567 |
|
|
2568 |
Last updated: 26 December 2007 |
Last updated: 23 January 2008 |
2569 |
Copyright (c) 1997-2007 University of Cambridge. |
Copyright (c) 1997-2008 University of Cambridge. |
2570 |
------------------------------------------------------------------------------ |
------------------------------------------------------------------------------ |
2571 |
|
|
2572 |
|
|
6321 |
bility of matching an empty string. Comments in the code explain what |
bility of matching an empty string. Comments in the code explain what |
6322 |
is going on. |
is going on. |
6323 |
|
|
6324 |
The demonstration program is automatically built if you use "./config- |
If PCRE is installed in the standard include and library directories |
6325 |
ure;make" to build PCRE. Otherwise, if PCRE is installed in the stan- |
for your system, you should be able to compile the demonstration pro- |
6326 |
dard include and library directories for your system, you should be |
gram using this command: |
|
able to compile the demonstration program using this command: |
|
6327 |
|
|
6328 |
gcc -o pcredemo pcredemo.c -lpcre |
gcc -o pcredemo pcredemo.c -lpcre |
6329 |
|
|
6330 |
If PCRE is installed elsewhere, you may need to add additional options |
If PCRE is installed elsewhere, you may need to add additional options |
6331 |
to the command line. For example, on a Unix-like system that has PCRE |
to the command line. For example, on a Unix-like system that has PCRE |
6332 |
installed in /usr/local, you can compile the demonstration program |
installed in /usr/local, you can compile the demonstration program |
6333 |
using a command like this: |
using a command like this: |
6334 |
|
|
6335 |
gcc -o pcredemo -I/usr/local/include pcredemo.c \ |
gcc -o pcredemo -I/usr/local/include pcredemo.c \ |
6336 |
-L/usr/local/lib -lpcre |
-L/usr/local/lib -lpcre |
6337 |
|
|
6338 |
Once you have compiled the demonstration program, you can run simple |
Once you have compiled the demonstration program, you can run simple |
6339 |
tests like this: |
tests like this: |
6340 |
|
|
6341 |
./pcredemo 'cat|dog' 'the cat sat on the mat' |
./pcredemo 'cat|dog' 'the cat sat on the mat' |
6342 |
./pcredemo -g 'cat|dog' 'the dog sat on the cat' |
./pcredemo -g 'cat|dog' 'the dog sat on the cat' |
6343 |
|
|
6344 |
Note that there is a much more comprehensive test program, called |
Note that there is a much more comprehensive test program, called |
6345 |
pcretest, which supports many more facilities for testing regular |
pcretest, which supports many more facilities for testing regular |
6346 |
expressions and the PCRE library. The pcredemo program is provided as a |
expressions and the PCRE library. The pcredemo program is provided as a |
6347 |
simple coding example. |
simple coding example. |
6348 |
|
|
6350 |
the standard library directory, you may get an error like this when you |
the standard library directory, you may get an error like this when you |
6351 |
try to run pcredemo: |
try to run pcredemo: |
6352 |
|
|
6353 |
ld.so.1: a.out: fatal: libpcre.so.0: open failed: No such file or |
ld.so.1: a.out: fatal: libpcre.so.0: open failed: No such file or |
6354 |
directory |
directory |
6355 |
|
|
6356 |
This is caused by the way shared library support works on those sys- |
This is caused by the way shared library support works on those sys- |
6357 |
tems. You need to add |
tems. You need to add |
6358 |
|
|
6359 |
-R/usr/local/lib |
-R/usr/local/lib |
6370 |
|
|
6371 |
REVISION |
REVISION |
6372 |
|
|
6373 |
Last updated: 13 June 2007 |
Last updated: 23 January 2008 |
6374 |
Copyright (c) 1997-2007 University of Cambridge. |
Copyright (c) 1997-2008 University of Cambridge. |
6375 |
------------------------------------------------------------------------------ |
------------------------------------------------------------------------------ |
6376 |
PCRESTACK(3) PCRESTACK(3) |
PCRESTACK(3) PCRESTACK(3) |
6377 |
|
|