5 |
.rs |
.rs |
6 |
.sp |
.sp |
7 |
A simple, complete demonstration program, to get you started with using PCRE, |
A simple, complete demonstration program, to get you started with using PCRE, |
8 |
is supplied in the file \fIpcredemo.c\fP in the PCRE distribution. |
is supplied in the file \fIpcredemo.c\fP in the PCRE distribution. A listing of |
9 |
|
this program is given in the |
10 |
|
.\" HREF |
11 |
|
\fBpcredemo\fP |
12 |
|
.\" |
13 |
|
documentation. If you do not have a copy of the PCRE distribution, you can save |
14 |
|
this listing to re-create \fIpcredemo.c\fP. |
15 |
.P |
.P |
16 |
The program compiles the regular expression that is its first argument, and |
The program compiles the regular expression that is its first argument, and |
17 |
matches it against the subject string in its second argument. No PCRE options |
matches it against the subject string in its second argument. No PCRE options |
25 |
an empty string. Comments in the code explain what is going on. |
an empty string. Comments in the code explain what is going on. |
26 |
.P |
.P |
27 |
If PCRE is installed in the standard include and library directories for your |
If PCRE is installed in the standard include and library directories for your |
28 |
system, you should be able to compile the demonstration program using this |
operating system, you should be able to compile the demonstration program using |
29 |
command: |
this command: |
30 |
.sp |
.sp |
31 |
gcc -o pcredemo pcredemo.c -lpcre |
gcc -o pcredemo pcredemo.c -lpcre |
32 |
.sp |
.sp |
50 |
\fBpcretest\fP, |
\fBpcretest\fP, |
51 |
.\" |
.\" |
52 |
which supports many more facilities for testing regular expressions and the |
which supports many more facilities for testing regular expressions and the |
53 |
PCRE library. The \fBpcredemo\fP program is provided as a simple coding |
PCRE library. The |
54 |
example. |
.\" HREF |
55 |
|
\fBpcredemo\fP |
56 |
|
.\" |
57 |
|
program is provided as a simple coding example. |
58 |
.P |
.P |
59 |
On some operating systems (e.g. Solaris), when PCRE is not installed in the |
When you try to run |
60 |
standard library directory, you may get an error like this when you try to run |
.\" HREF |
61 |
\fBpcredemo\fP: |
\fBpcredemo\fP |
62 |
|
.\" |
63 |
|
when PCRE is not installed in the standard library directory, you may get an |
64 |
|
error like this on some operating systems (e.g. Solaris): |
65 |
.sp |
.sp |
66 |
ld.so.1: a.out: fatal: libpcre.so.0: open failed: No such file or directory |
ld.so.1: a.out: fatal: libpcre.so.0: open failed: No such file or directory |
67 |
.sp |
.sp |
87 |
.rs |
.rs |
88 |
.sp |
.sp |
89 |
.nf |
.nf |
90 |
Last updated: 23 January 2008 |
Last updated: 30 September 2009 |
91 |
Copyright (c) 1997-2008 University of Cambridge. |
Copyright (c) 1997-2009 University of Cambridge. |
92 |
.fi |
.fi |