3 <meta name="generator" content="groff -Thtml, see www.gnu.org">
4 <meta name="Content-Style" content="text/css">
9 <h1 align=center>psubst</h1>
10 <a href="#NAME">NAME</a><br>
11 <a href="#SYNOPSIS">SYNOPSIS</a><br>
12 <a href="#DESCRIPTION">DESCRIPTION</a><br>
13 <a href="#AUTHOR">AUTHOR</a><br>
14 <a href="#LICENSE">LICENSE</a><br>
15 <a href="#VERSION">VERSION</a><br>
18 <!-- Creator : groff version 1.17.2 -->
19 <!-- CreationDate: Fri May 3 14:58:04 2002 -->
22 <table width="100%" border=0 rules="none" frame="void"
23 cols="2" cellspacing="0" cellpadding="0">
24 <tr valign="top" align="left">
25 <td width="10%"></td><td width="90%">
26 psubst, psubstx - substitute string matching regular expression</td></table>
27 <a name="SYNOPSIS"></a>
30 <table width="100%" border=0 rules="none" frame="void"
31 cols="2" cellspacing="0" cellpadding="0">
32 <tr valign="top" align="left">
33 <td width="10%"></td><td width="90%">
34 <pre><b>#include <pstring.h>
36 #define psubst(p,str,pat,sub) psubstx ((p), (str), (pat), (sub), REG_EXTENDED, 0, 0)
37 const char *psubstx (pool, const char *str, const char *pat, const char *sub, int cflags, int eflags, int flags);
38 </b></pre></td></table>
39 <a name="DESCRIPTION"></a>
42 <table width="100%" border=0 rules="none" frame="void"
43 cols="2" cellspacing="0" cellpadding="0">
44 <tr valign="top" align="left">
45 <td width="10%"></td><td width="90%">
46 <b>psubst</b> is used as a quick way to substitute strings
47 which match a regular expression with other strings. It is
48 the equivalent of the <b>s///</b> operator in Perl. The
49 function internally caches compiled regular expressions for
50 speed. The function returns a new string which is formed
51 from <b>str</b> by substituting string <b>sub</b> for the
52 first regular expression which matches
53 <b>pat</b>.</td></table>
55 <table width="100%" border=0 rules="none" frame="void"
56 cols="2" cellspacing="0" cellpadding="0">
57 <tr valign="top" align="left">
58 <td width="10%"></td><td width="90%">
59 <b>psubstx</b> is the same as <b>psubst</b> except that it
60 allows greater control with flags. <b>cflags</b> and
61 <b>eflags</b> are passed directly to <b>regcomp(3)</b> and
62 <b>regexec(3)</b> respectively. <b>flags</b> may
65 <table width="100%" border=0 rules="none" frame="void"
66 cols="2" cellspacing="0" cellpadding="0">
67 <tr valign="top" align="left">
68 <td width="10%"></td><td width="90%">
69 <b>PSUBST_GLOBAL</b>: Match and replace every instance of
70 <b>pat</b> in the string, not just the first.</td></table>
72 <table width="100%" border=0 rules="none" frame="void"
73 cols="2" cellspacing="0" cellpadding="0">
74 <tr valign="top" align="left">
75 <td width="10%"></td><td width="90%">
76 <b>PSUBST_NO_CACHE</b>: Compile the regular expression
77 regardless of whether the <b>re</b> is stored in the cache,
78 and do not store the compiled regular expression back into
79 the cache. This flag is useful to save memory if you know
80 that the particular <b>re</b> will only be used very
81 infrequently, and hence storing it in the cache would just
82 be a waste of space.</td></table>
84 <table width="100%" border=0 rules="none" frame="void"
85 cols="2" cellspacing="0" cellpadding="0">
86 <tr valign="top" align="left">
87 <td width="10%"></td><td width="90%">
88 Note that the state of <b>cflags</b> is not stored in the
89 cache. In rare circumstances this could cause
90 problems.</td></table>
94 <table width="100%" border=0 rules="none" frame="void"
95 cols="2" cellspacing="0" cellpadding="0">
96 <tr valign="top" align="left">
97 <td width="10%"></td><td width="90%">
98 Richard Jones <rich@annexia.org></td></table>
99 <a name="LICENSE"></a>
102 <table width="100%" border=0 rules="none" frame="void"
103 cols="2" cellspacing="0" cellpadding="0">
104 <tr valign="top" align="left">
105 <td width="10%"></td><td width="90%">
106 GNU LGPL (see http://www.gnu.org/)</td></table>
107 <a name="VERSION"></a>
110 <table width="100%" border=0 rules="none" frame="void"
111 cols="2" cellspacing="0" cellpadding="0">
112 <tr valign="top" align="left">
113 <td width="10%"></td><td width="90%">
114 c2lib-1.2.13</td></table>