/[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 - (show annotations)
Wed Jun 13 15:09:54 2007 UTC (8 years ago) by ph10
File MIME type: text/html
File size: 3183 byte(s)
Error occurred while calculating annotation data.
More document tidies, pre-release.
1 <html>
2 <head>
3 <title>pcresample specification</title>
4 </head>
5 <body bgcolor="#FFFFFF" text="#00005A" link="#0066FF" alink="#3399FF" vlink="#2222BB">
6 <h1>pcresample man page</h1>
7 <p>
8 Return to the <a href="index.html">PCRE index page</a>.
9 </p>
10 <p>
11 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 <br>
15 <br><b>
16 PCRE SAMPLE PROGRAM
17 </b><br>
18 <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 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 <pre>
41 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 <pre>
48 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 ./pcredemo 'cat|dog' 'the cat sat on the mat'
54 ./pcredemo -g 'cat|dog' 'the dog sat on the cat'
55 </pre>
56 Note that there is a much more comprehensive test program, called
57 <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 </P>
62 <P>
63 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 <pre>
67 ld.so.1: a.out: fatal: libpcre.so.0: open failed: No such file or directory
68 </pre>
69 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 </pre>
74 (for example) to the compile command to get round this problem.
75 </P>
76 <br><b>
77 AUTHOR
78 </b><br>
79 <P>
80 Philip Hazel
81 <br>
82 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 Last updated: 13 June 2007
92 <br>
93 Copyright &copy; 1997-2007 University of Cambridge.
94 <br>
95 <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"

  ViewVC Help
Powered by ViewVC 1.1.5