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

Contents of /code/trunk/doc/html/pcresample.html

Parent Directory Parent Directory | Revision Log Revision Log


Revision 182 - (hide annotations) (download) (as text)
Wed Jun 13 15:09:54 2007 UTC (7 years, 4 months ago) by ph10
File MIME type: text/html
File size: 3183 byte(s)
More document tidies, pre-release.

1 nigel 63 <html>
2     <head>
3     <title>pcresample specification</title>
4     </head>
5     <body bgcolor="#FFFFFF" text="#00005A" link="#0066FF" alink="#3399FF" vlink="#2222BB">
6 nigel 75 <h1>pcresample man page</h1>
7     <p>
8     Return to the <a href="index.html">PCRE index page</a>.
9     </p>
10 ph10 111 <p>
11 nigel 75 This page is part of the PCRE HTML documentation. It was generated automatically
12     from the original man page. If there is any nonsense in it, please consult the
13     man page, in case the conversion went wrong.
14 ph10 111 <br>
15 nigel 75 <br><b>
16     PCRE SAMPLE PROGRAM
17     </b><br>
18 nigel 63 <P>
19     A simple, complete demonstration program, to get you started with using PCRE,
20     is supplied in the file <i>pcredemo.c</i> in the PCRE distribution.
21     </P>
22     <P>
23     The program compiles the regular expression that is its first argument, and
24     matches it against the subject string in its second argument. No PCRE options
25     are set, and default character tables are used. If matching succeeds, the
26     program outputs the portion of the subject that matched, together with the
27     contents of any captured substrings.
28     </P>
29     <P>
30     If the -g option is given on the command line, the program then goes on to
31     check for further matches of the same regular expression in the same subject
32     string. The logic is a little bit tricky because of the possibility of matching
33     an empty string. Comments in the code explain what is going on.
34     </P>
35     <P>
36 ph10 182 The demonstration program is automatically built if you use "./configure;make"
37     to build PCRE. Otherwise, if PCRE is installed in the standard include and
38     library directories for your system, you should be able to compile the
39     demonstration program using this command:
40 nigel 63 <pre>
41 nigel 75 gcc -o pcredemo pcredemo.c -lpcre
42     </pre>
43     If PCRE is installed elsewhere, you may need to add additional options to the
44     command line. For example, on a Unix-like system that has PCRE installed in
45     <i>/usr/local</i>, you can compile the demonstration program using a command
46     like this:
47 nigel 63 <pre>
48 nigel 75 gcc -o pcredemo -I/usr/local/include pcredemo.c -L/usr/local/lib -lpcre
49     </pre>
50     Once you have compiled the demonstration program, you can run simple tests like
51     this:
52     <pre>
53 nigel 63 ./pcredemo 'cat|dog' 'the cat sat on the mat'
54     ./pcredemo -g 'cat|dog' 'the dog sat on the cat'
55 nigel 75 </pre>
56 nigel 63 Note that there is a much more comprehensive test program, called
57 nigel 75 <a href="pcretest.html"><b>pcretest</b>,</a>
58     which supports many more facilities for testing regular expressions and the
59     PCRE library. The <b>pcredemo</b> program is provided as a simple coding
60     example.
61 nigel 63 </P>
62     <P>
63 nigel 75 On some operating systems (e.g. Solaris), when PCRE is not installed in the
64     standard library directory, you may get an error like this when you try to run
65     <b>pcredemo</b>:
66 nigel 63 <pre>
67     ld.so.1: a.out: fatal: libpcre.so.0: open failed: No such file or directory
68 nigel 75 </pre>
69 nigel 63 This is caused by the way shared library support works on those systems. You
70     need to add
71     <pre>
72     -R/usr/local/lib
73 nigel 75 </pre>
74     (for example) to the compile command to get round this problem.
75 nigel 63 </P>
76 ph10 99 <br><b>
77     AUTHOR
78     </b><br>
79 nigel 63 <P>
80 ph10 99 Philip Hazel
81 nigel 63 <br>
82 ph10 99 University Computing Service
83     <br>
84     Cambridge CB2 3QH, England.
85     <br>
86     </P>
87     <br><b>
88     REVISION
89     </b><br>
90     <P>
91 ph10 182 Last updated: 13 June 2007
92 ph10 99 <br>
93     Copyright &copy; 1997-2007 University of Cambridge.
94     <br>
95 nigel 75 <p>
96     Return to the <a href="index.html">PCRE index page</a>.
97     </p>

Properties

Name Value
svn:eol-style native
svn:keywords "Author Date Id Revision Url"

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12