/[pcre]/code/trunk/doc/pcresample.3
ViewVC logotype

Diff of /code/trunk/doc/pcresample.3

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 99 by ph10, Tue Mar 6 12:27:42 2007 UTC revision 572 by ph10, Wed Nov 17 17:55:57 2010 UTC
# Line 5  PCRE - Perl-compatible regular expressio Line 5  PCRE - Perl-compatible regular expressio
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
# Line 19  string. The logic is a little bit tricky Line 25  string. The logic is a little bit tricky
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
# Line 33  like this: Line 39  like this:
39    gcc -o pcredemo -I/usr/local/include pcredemo.c \e    gcc -o pcredemo -I/usr/local/include pcredemo.c \e
40        -L/usr/local/lib -lpcre        -L/usr/local/lib -lpcre
41  .sp  .sp
42  Once you have compiled the demonstration program, you can run simple tests like  In a Windows environment, if you want to statically link the program against a
43  this:  non-dll \fBpcre.a\fP file, you must uncomment the line that defines PCRE_STATIC
44    before including \fBpcre.h\fP, because otherwise the \fBpcre_malloc()\fP and
45    \fBpcre_free()\fP exported functions will be declared
46    \fB__declspec(dllimport)\fP, with unwanted results.
47    .P
48    Once you have compiled and linked the demonstration program, you can run simple
49    tests like this:
50  .sp  .sp
51    ./pcredemo 'cat|dog' 'the cat sat on the mat'    ./pcredemo 'cat|dog' 'the cat sat on the mat'
52    ./pcredemo -g 'cat|dog' 'the dog sat on the cat'    ./pcredemo -g 'cat|dog' 'the dog sat on the cat'
# Line 44  Note that there is a much more comprehen Line 56  Note that there is a much more comprehen
56  \fBpcretest\fP,  \fBpcretest\fP,
57  .\"  .\"
58  which supports many more facilities for testing regular expressions and the  which supports many more facilities for testing regular expressions and the
59  PCRE library. The \fBpcredemo\fP program is provided as a simple coding  PCRE library. The
60  example.  .\" HREF
61    \fBpcredemo\fP
62    .\"
63    program is provided as a simple coding example.
64  .P  .P
65  On some operating systems (e.g. Solaris), when PCRE is not installed in the  If you try to run
66  standard library directory, you may get an error like this when you try to run  .\" HREF
67  \fBpcredemo\fP:  \fBpcredemo\fP
68    .\"
69    when PCRE is not installed in the standard library directory, you may get an
70    error like this on some operating systems (e.g. Solaris):
71  .sp  .sp
72    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
73  .sp  .sp
# Line 75  Cambridge CB2 3QH, England. Line 93  Cambridge CB2 3QH, England.
93  .rs  .rs
94  .sp  .sp
95  .nf  .nf
96  Last updated: 06 March 2007  Last updated: 17 November 2010
97  Copyright (c) 1997-2007 University of Cambridge.  Copyright (c) 1997-2010 University of Cambridge.
98  .fi  .fi

Legend:
Removed from v.99  
changed lines
  Added in v.572

  ViewVC Help
Powered by ViewVC 1.1.5