home *** CD-ROM | disk | FTP | other *** search
/ PC Extra Super CD 1998 January / PCPLUS131.iso / DJGPP / V2 / DJLSR201.ZIP / src / libc / posix / regex / regex.txh < prev    next >
Encoding:
Text File  |  1996-04-27  |  22.2 KB  |  552 lines

  1. @node regcomp, string
  2. @subheading Syntax
  3.  
  4. @example
  5. #include <sys/types.h>
  6. #include <regex.h>
  7.  
  8. int regcomp(regex_t *preg, const char *pattern, int cflags);
  9. @end example
  10.  
  11. @subheading Description
  12.  
  13. This function is part of the implementation of POSIX 1003.2 regular
  14. expressions (@dfn{RE}s).
  15.  
  16. @code{regcomp} compiles the regular expression contained in the
  17. @var{pattern} string, subject to the flags in @var{cflags}, and places
  18. the results in the @code{regex_t} structure pointed to by @var{preg}.
  19. (The regular expression syntax, as defined by POSIX 1003.2, is described
  20. below.)
  21.  
  22. The parameter @var{cflags} is the bitwise OR of zero or more of the
  23. following flags:
  24.  
  25. @table @code
  26.  
  27. @item REG_EXTENDED
  28.  
  29. Compile modern (@dfn{extended}) REs, rather than the obsolete
  30. (@dfn{basic}) REs that are the default.
  31.  
  32. @item REG_BASIC
  33.  
  34. This is a synonym for 0, provided as a counterpart to
  35. @code{REG_EXTENDED} to improve readability.
  36.  
  37. @item REG_NOSPEC
  38.  
  39. Compile with recognition of all special characters turned off.  All
  40. characters are thus considered ordinary, so the RE in @var{pattern} is a
  41. literal string.  This is an extension, compatible with but not specified
  42. by POSIX 1003.2, and should be used with caution in software intended to
  43. be portable to other systems.  @code{REG_EXTENDED} and @code{REG_NOSPEC}
  44. may not be used in the same call to @code{regcomp}.
  45.  
  46. @item REG_ICASE
  47.  
  48. Compile for matching that ignores upper/lower case distinctions.  See
  49. the description of regular expressions below for details of
  50. case-independent matching.
  51.  
  52. @item REG_NOSUB
  53.  
  54. Compile for matching that need only report success or failure, not what
  55. was matched.
  56.  
  57. @item REG_NEWLINE
  58.  
  59. Compile for newline-sensitive matching.  By default, newline is a
  60. completely ordinary character with no special meaning in either REs or
  61. strings.  With this flag, @samp{[^} bracket expressions and @samp{.}
  62. never match newline, a @samp{^} anchor matches the null string after any
  63. newline in the string in addition to its normal function, and the
  64. @samp{$} anchor matches the null string before any newline in the string
  65. in addition to its normal function.
  66.  
  67. @item REG_PEND
  68.  
  69. The regular expression ends, not at the first NUL, but just before the
  70. character pointed to by the @code{re_endp} member of the structure
  71. pointed to by @var{preg}.  The @code{re_endp} member is of type
  72. @samp{const char *}.  This flag permits inclusion of NULs in the RE;
  73. they are considered ordinary characters.  This is an extension,
  74. compatible with but not specified by POSIX 1003.2, and should be used
  75. with caution in software intended to be portable to other systems.
  76.  
  77. @end table
  78.  
  79. When successful, @code{regcomp} returns 0 and fills in the structure
  80. pointed to by @var{preg}.  One member of that structure (other than
  81. @code{re_endp}) is publicized: @code{re_nsub}, of type @code{size_t},
  82. contains the number of parenthesized subexpressions within the RE
  83. (except that the value of this member is undefined if the
  84. @code{REG_NOSUB} flag was used).
  85.  
  86. Note that the length of the RE does matter; in particular, there is a
  87. strong speed bonus for keeping RE length under about 30 characters,
  88. with most special characters counting roughly double.
  89.  
  90. @subheading Return Value
  91.  
  92. If @code{regcomp} succeeds, it returns zero; if it fails, it returns a
  93. non-zero error code, which is one of these:
  94.  
  95. @table @code
  96.  
  97. @item REG_BADPAT
  98.  
  99. invalid regular expression
  100.  
  101. @item REG_ECOLLATE
  102.  
  103. invalid collating element
  104.  
  105. @item REG_ECTYPE
  106.  
  107. invalid character class
  108.  
  109. @item REG_EESCAPE
  110.  
  111. @samp{\} applied to unescapable character
  112.  
  113. @item REG_ESUBREG
  114.  
  115. invalid backreference number (e.g., larger than the number of
  116. parenthesized subexpressions in the RE)
  117.  
  118. @item REG_EBRACK
  119.  
  120. brackets [ ] not balanced
  121.  
  122. @item REG_EPAREN
  123.  
  124. parentheses ( ) not balanced
  125.  
  126. @item REG_EBRACE
  127.  
  128. braces @{ @} not balanced
  129.  
  130. @item REG_BADBR
  131.  
  132. invalid repetition count(s) in @{ @}
  133.  
  134. @item REG_ERANGE
  135.  
  136. invalid character range in [ ]
  137.  
  138. @item REG_ESPACE
  139.  
  140. ran out of memory (an RE like, say,
  141. @samp{((((a@{1,100@})@{1,100@})@{1,100@})@{1,100@})@{1,100@}'} will
  142. eventually run almost any existing machine out of swap space)
  143.  
  144. @item REG_BADRPT
  145.  
  146. ?, *, or + operand invalid
  147.  
  148. @item REG_EMPTY
  149.  
  150. empty (sub)expression
  151.  
  152. @item REG_ASSERT
  153.  
  154. ``can't happen'' (you found a bug in @code{regcomp})
  155.  
  156. @item REG_INVARG
  157.  
  158. invalid argument (e.g. a negative-length string)
  159.  
  160. @end table
  161.  
  162. @subheading Regular Expressions' Syntax
  163.  
  164. Regular expressions (@dfn{RE}s), as defined in POSIX 1003.2, come in two
  165. forms: modern REs (roughly those of @code{egrep}; 1003.2 calls these
  166. @emph{extended} REs) and obsolete REs (roughly those of @code{ed};
  167. 1003.2 @emph{basic} REs).  Obsolete REs mostly exist for backward
  168. compatibility in some old programs; they will be discussed at the end.
  169. 1003.2 leaves some aspects of RE syntax and semantics open; `(*)' marks
  170. decisions on these aspects that may not be fully portable to other
  171. 1003.2 implementations.
  172.  
  173. A (modern) RE is one(*) or more non-empty(*) @emph{branches}, separated
  174. by @samp{|}.  It matches anything that matches one of the branches.
  175.  
  176. A branch is one(*) or more @emph{pieces}, concatenated.  It matches a
  177. match for the first, followed by a match for the second, etc.
  178.  
  179. A piece is an @emph{atom} possibly followed by a single(*) `*', `+',
  180. `?', or @emph{bound}.
  181. An atom followed by `*' matches a sequence of 0 or more matches of the atom.
  182. An atom followed by `+' matches a sequence of 1 or more matches of the atom.
  183. An atom followed by `?' matches a sequence of 0 or 1 matches of the atom.
  184.  
  185. A @emph{bound} is `@{' followed by an unsigned decimal integer, possibly
  186. followed by `,' possibly followed by another unsigned decimal integer,
  187. always followed by `@}'.  The integers must lie between 0 and
  188. @code{RE_DUP_MAX} (255(*)) inclusive, and if there are two of them, the
  189. first may not exceed the second.  An atom followed by a bound containing
  190. one integer @samp{i} and no comma matches a sequence of exactly @samp{i}
  191. matches of the atom.  An atom followed by a bound containing one integer
  192. @samp{i} and a comma matches a sequence of @samp{i} or more matches of
  193. the atom.  An atom followed by a bound containing two integers @samp{i}
  194. and @samp{j} matches a sequence of @samp{i} through @samp{j} (inclusive)
  195. matches of the atom.
  196.  
  197. An atom is a regular expression enclosed in `()' (matching a match for the
  198. regular expression), an empty set of `()' (matching the null string(*)),
  199. a @emph{bracket expression} (see below), `.' (matching any single
  200. character), `^' (matching the null string at the beginning of a line),
  201. `$' (matching the null string at the end of a line), a `\\' followed by
  202. one of the characters `^.[$()|*+?@{\\' (matching that character taken as
  203. an ordinary character), a `\\' followed by any other character(*)
  204. (matching that character taken as an ordinary character, as if the `\\'
  205. had not been present(*)), or a single character with no other
  206. significance (matching that character).  A `@{' followed by a character
  207. other than a digit is an ordinary character, not the beginning of a
  208. bound(*).  It is illegal to end an RE with `\\'.
  209.  
  210. A @emph{bracket expression} is a list of characters enclosed in `[]'.
  211. It normally matches any single character from the list (but see below).
  212. If the list begins with `^', it matches any single character (but see
  213. below) @emph{not} from the rest of the list.  If two characters in the
  214. list are separated by `-', this is shorthand for the full @emph{range}
  215. of characters between those two (inclusive) in the collating sequence,
  216. e.g. `[0-9]' in ASCII matches any decimal digit.  It is illegal(*) for
  217. two ranges to share an endpoint, e.g. `a-c-e'.  Ranges are very
  218. collating-sequence-dependent, and portable programs should avoid relying
  219. on them.
  220.  
  221. To include a literal `]' in the list, make it the first character
  222. (following a possible `^').  To include a literal `-', make it the
  223. first or last character, or the second endpoint of a range.  To use a
  224. literal `-' as the first endpoint of a range, enclose it in `[.' and
  225. `.]' to make it a collating element (see below).  With the exception of
  226. these and some combinations using `[' (see next paragraphs), all other
  227. special characters, including `\\', lose their special significance
  228. within a bracket expression.
  229.  
  230. Within a bracket expression, a collating element (a character, a
  231. multi-character sequence that collates as if it were a single character,
  232. or a collating-sequence name for either) enclosed in `[.' and `.]'
  233. stands for the sequence of characters of that collating element.  The
  234. sequence is a single element of the bracket expression's list.  A
  235. bracket expression containing a multi-character collating element can
  236. thus match more than one character, e.g. if the collating sequence
  237. includes a `ch' collating element, then the RE @samp{[[.ch.]]*c} matches
  238. the first five characters of ``chchcc''.
  239.  
  240. Within a bracket expression, a collating element enclosed in `[=' and
  241. `=]' is an equivalence class, standing for the sequences of characters
  242. of all collating elements equivalent to that one, including itself.
  243. (If there are no other equivalent collating elements, the treatment is
  244. as if the enclosing delimiters were `[.' and `.]'.)  For example, if o
  245. and \o'o^' are the members of an equivalence class, then `[[=o=]]',
  246. `[[=\o'o^'=]]', and `[o\o'o^']' are all synonymous.  An equivalence
  247. class may not\(dg be an endpoint of a range.
  248.  
  249. Within a bracket expression, the name of a @emph{character class}
  250. enclosed in `[:' and `:]' stands for the list of all characters
  251. belonging to that class.
  252. Standard character class names are:
  253.  
  254. @example
  255. alnum    digit    punct
  256. alpha    graph    space
  257. blank    lower    upper
  258. cntrl    print    xdigit
  259. @end example
  260.  
  261. These stand for the character classes defined by @code{isalnum}
  262. (@pxref{isalnum}), @code{isdigit} (@pxref{isdigit}), @code{ispunct}
  263. (@pxref{ispunct}), @code{isalpha} (@pxref{isalpha}), @code{isgraph}
  264. (@pxref{isgraph}), @code{isspace} (@pxref{isspace}) (@code{blank} is the
  265. same as @code{space}), @code{islower} (@pxref{islower}), @code{isupper}
  266. (@pxref{isupper}), @code{iscntrl} (@pxref{iscntrl}), @code{isprint}
  267. (@pxref{isprint}), and @code{isxdigit} (@pxref{isxdigit}),
  268. respectively.  A locale may provide others.  A character class may not
  269. be used as an endpoint of a range.
  270.  
  271. There are two special cases(*) of bracket expressions: the bracket
  272. expressions `[[:<:]]' and `[[:>:]]' match the null string at the
  273. beginning and end of a word respectively.  A word is defined as a
  274. sequence of word characters which is neither preceded nor followed by
  275. word characters.  A word character is an @code{alnum} character (as
  276. defined by @code{isalnum} library function) or an underscore.  This is
  277. an extension, compatible with but not specified by POSIX 1003.2, and
  278. should be used with caution in software intended to be portable to other
  279. systems.
  280.  
  281. In the event that an RE could match more than one substring of a given
  282. string, the RE matches the one starting earliest in the string.  If the
  283. RE could match more than one substring starting at that point, it
  284. matches the longest.  Subexpressions also match the longest possible
  285. substrings, subject to the constraint that the whole match be as long as
  286. possible, with subexpressions starting earlier in the RE taking priority
  287. over ones starting later.  Note that higher-level subexpressions thus
  288. take priority over their lower-level component subexpressions.
  289.  
  290. Match lengths are measured in characters, not collating elements.  A
  291. null string is considered longer than no match at all.  For example,
  292. @samp{bb*} matches the three middle characters of @samp{abbbc}, 
  293. @samp{(wee|week)(knights|nights)} matches all ten characters of
  294. @samp{weeknights}, when @samp{(.*).*} is matched against @samp{abc} the
  295. parenthesized subexpression matches all three characters, and when
  296. @samp{(a*)*} is matched against `bc' both the whole RE and the
  297. parenthesized subexpression match the null string.
  298.  
  299. If case-independent matching is specified, the effect is much as if all
  300. case distinctions had vanished from the alphabet.  When an alphabetic
  301. that exists in multiple cases appears as an ordinary character outside a
  302. bracket expression, it is effectively transformed into a bracket
  303. expression containing both cases, e.g. `x' becomes `[xX]'.  When it
  304. appears inside a bracket expression, all case counterparts of it are
  305. added to the bracket expression, so that (e.g.) `[x]' becomes `[xX]' and
  306. `[^x]' becomes `[^xX]'.
  307.  
  308. No particular limit is imposed on the length of REs(*).  Programs
  309. intended to be portable should not employ REs longer than 256 bytes,
  310. as an implementation can refuse to accept such REs and remain
  311. POSIX-compliant.
  312.  
  313. Obsolete (@emph{basic}) regular expressions differ in several respects.
  314. `|', `+', and `?' are ordinary characters and there is no equivalent
  315. for their functionality.  The delimiters for bounds are `\\@{' and
  316. `\\@}', with `@{' and `@}' by themselves ordinary characters.  The
  317. parentheses for nested subexpressions are `\(' and `\)', with `(' and
  318. `)' by themselves ordinary characters.  `^' is an ordinary character
  319. except at the beginning of the RE or(*) the beginning of a parenthesized
  320. subexpression, `$' is an ordinary character except at the end of the RE
  321. or(*) the end of a parenthesized subexpression, and `*' is an ordinary
  322. character if it appears at the beginning of the RE or the beginning of a
  323. parenthesized subexpression (after a possible leading `^').
  324. Finally, there is one new type of atom, a @emph{back reference}:
  325. `\\' followed by a non-zero decimal digit @emph{d} matches the same
  326. sequence of characters matched by the @emph{d}th parenthesized
  327. subexpression (numbering subexpressions by the positions of their
  328. opening parentheses, left to right), so that (e.g.) @samp{\\([bc]\\)\\1}
  329. matches `bb' or `cc' but not `bc'.
  330.  
  331. @c -------------------------------------------------------------------------
  332.  
  333. @node regexec, string
  334. @subheading Syntax
  335.  
  336. @example
  337. #include <sys/types.h>
  338. #include <regex.h>
  339.  
  340. int regexec(const regex_t *preg, const char *string,
  341.             size_t nmatch, regmatch_t pmatch[], int eflags);
  342. @end example
  343.  
  344.  
  345. @subheading Description
  346.  
  347. @code{regexec} matches the compiled RE pointed to by @var{preg} against
  348. the @var{string}, subject to the flags in @var{eflags}, and reports
  349. results using @var{nmatch}, @var{pmatch}, and the returned value.  The
  350. RE must have been compiled by a previous invocation of @code{regcomp}
  351. (@pxref{regcomp}).  The compiled form is not altered during execution of
  352. @code{regexec}, so a single compiled RE can be used simultaneously by
  353. multiple threads.
  354.  
  355. By default, the NUL-terminated string pointed to by @var{string} is
  356. considered to be the text of an entire line, minus any terminating
  357. newline.
  358.  
  359. The @var{eflags} argument is the bitwise OR of zero or more of the
  360. following flags:
  361.  
  362. @table @code
  363.  
  364. @item REG_NOTBOL
  365.  
  366. The first character of the string is not the beginning of a line, so the
  367. `^' anchor should not match before it.  This does not affect the
  368. behavior of newlines under @code{REG_NEWLINE} (REG_NEWLINE,
  369. @pxref{regcomp}).
  370.  
  371. @item REG_NOTEOL
  372.  
  373. The NUL terminating the string does not end a line, so the `$' anchor
  374. should not match before it.  This does not affect the behavior of
  375. newlines under @code{REG_NEWLINE} (REG_NEWLINE, @pxref{regcomp}).
  376.  
  377. @item REG_STARTEND
  378.  
  379. The string is considered to start at @var{@w{string + pmatch[0].rm_so}}
  380. and to have a terminating @code{NUL} located at
  381. @var{@w{string + pmatch[0].rm_eo}} (there need not actually be a
  382. @code{NUL} at that location), regardless of the value of @var{nmatch}.
  383. See below for the definition of @var{pmatch} and @var{nmatch}.  This is
  384. an extension, compatible with but not specified by POSIX 1003.2, and
  385. should be used with caution in software intended to be portable to other
  386. systems.  Note that a non-zero @code{rm_so} does not imply
  387. @code{REG_NOTBOL}; @code{REG_STARTEND} affects only the location of the
  388. string, not how it is matched.
  389.  
  390. @item REG_TRACE
  391.  
  392. trace execution (printed to stdout)
  393.  
  394. @item REG_LARGE
  395.  
  396. force large representation
  397.  
  398. @item REG_BACKR
  399.  
  400. force use of backref code
  401.  
  402. @end table
  403.  
  404. Regular Expressions' Syntax, @xref{regcomp}, for a discussion of what is
  405. matched in situations where an RE or a portion thereof could match any
  406. of several substrings of @var{string}.
  407.  
  408. If @code{REG_NOSUB} was specified in the compilation of the RE
  409. (REG_NOSUB, @pxref{regcomp}), or if @var{nmatch} is 0, @code{regexec}
  410. ignores the @var{pmatch} argument (but see below for the case where
  411. @code{REG_STARTEND} is specified).  Otherwise, @var{pmatch} should point
  412. to an array of @var{nmatch} structures of type @code{regmatch_t}.  Such
  413. a structure has at least the members @code{rm_so} and @code{rm_eo}, both
  414. of type @code{regoff_t} (a signed arithmetic type at least as large as
  415. an @code{off_t} and a @code{ssize_t}, containing respectively the offset
  416. of the first character of a substring and the offset of the first
  417. character after the end of the substring.  Offsets are measured from the
  418. beginning of the @var{string} argument given to @code{regexec}.  An
  419. empty substring is denoted by equal offsets, both indicating the
  420. character following the empty substring.
  421.  
  422. When @code{regexec} returns, the 0th member of the @var{pmatch} array is
  423. filled in to indicate what substring of @var{string} was matched by the
  424. entire RE.  Remaining members report what substring was matched by
  425. parenthesized subexpressions within the RE; member @code{i} reports
  426. subexpression @code{i}, with subexpressions counted (starting at 1) by
  427. the order of their opening parentheses in the RE, left to right.  Unused
  428. entries in the array---corresponding either to subexpressions that did
  429. not participate in the match at all, or to subexpressions that do not
  430. exist in the RE (that is, @code{@w{i > preg->re_nsub}}---have both
  431. @code{rm_so} and @code{rm_eo} set to @code{-1}.  If a subexpression
  432. participated in the match several times, the reported substring is the
  433. last one it matched.  (Note, as an example in particular, that when the
  434. RE @samp{(b*)+} matches @samp{bbb}, the parenthesized subexpression
  435. matches each of the three `b's and then an infinite number of empty
  436. strings following the last `b', so the reported substring is one of the
  437. empties.)
  438.  
  439. If @code{REG_STARTEND} is specified in @var{eflags}, @var{pmatch} must
  440. point to at least one @code{regmatch_t} variable (even if @var{nmatch}
  441. is 0 or @code{REG_NOSUB} was specified in the compilation of the RE,
  442. REG_NOSUB, @pxref{regcomp}), to hold the input offsets for
  443. @code{REG_STARTEND}.  Use for output is still entirely controlled by
  444. @var{nmatch}; if @var{nmatch} is 0 or @code{REG_NOSUB} was specified,
  445. the value of @code{pmatch[0]} will not be changed by a successful
  446. @code{regexec}.
  447.  
  448. @var{nmatch} exceeding 0 is expensive; @var{nmatch} exceeding 1 is
  449. worse.  Back references are massively expensive.
  450.  
  451. @subheading Return Value
  452.  
  453. Normally, @code{regexec} returns 0 for success and the non-zero code
  454. @code{REG_NOMATCH} for failure.  Other non-zero error codes may be
  455. returned in exceptional situations.  The list of possible error return
  456. values is below:
  457.  
  458. @table @code
  459.  
  460. @item REG_ESPACE
  461.  
  462. ran out of memory
  463.  
  464. @item REG_BADPAT
  465.  
  466. the passed argument @var{preg} doesn't point to an RE compiled by
  467. @code{regcomp}
  468.  
  469. @item REG_INVARG
  470.  
  471. invalid argument(s) (e.g., @var{@w{string + pmatch[0].rm_eo}} is less
  472. than @var{@w{string + pmatch[0].rm_so}})
  473.  
  474. @end table
  475.  
  476. @c ----------------------------------------------------------------------
  477.  
  478. @node regerror, string
  479. @subheading Syntax
  480.  
  481. @example
  482.  
  483. #include <sys/types.h>
  484. #include <regex.h>
  485.  
  486. size_t regerror(int errcode, const regex_t *preg,
  487.                 char *errbuf, size_t errbuf_size);
  488.  
  489. @end example
  490.  
  491. @subheading Description
  492.  
  493. @code{regerror} maps a non-zero value of @var{errcode} from either
  494. @code{regcomp} (Return Value, @pxref{regcomp}) or @code{regexec}
  495. (Return Value, @pxref{regexec}) to a human-readable, printable message.
  496.  
  497. If @var{preg} is non-@code{NULL}, the error code should have arisen from
  498. use of the variable of the type @code{regex_t} pointed to by @var{preg},
  499. and if the error code came from @code{regcomp}, it should have been the
  500. result from the most recent @code{regcomp} using that @code{regex_t}
  501. variable.  (@code{regerror} may be able to supply a more detailed
  502. message using information from the @code{regex_t} than from
  503. @var{errcode} alone.)  @code{regerror} places the @code{NUL}-terminated
  504. message into the buffer pointed to by @var{errbuf}, limiting the length
  505. (including the @code{NUL}) to at most @var{errbuf_size} bytes.  If the
  506. whole message won't fit, as much of it as will fit before the
  507. terminating @code{NUL} is supplied.  In any case, the returned value is
  508. the size of buffer needed to hold the whole message (including
  509. terminating @code{NUL}).  If @var{errbuf_size} is 0, @var{errbuf} is
  510. ignored but the return value is still correct.
  511.  
  512. If the @var{errcode} given to @code{regerror} is first ORed with
  513. @code{REG_ITOA}, the ``message'' that results is the printable name of
  514. the error code, e.g. ``REG_NOMATCH'', rather than an explanation
  515. thereof.  If @var{errcode} is @code{REG_ATOI}, then @var{preg} shall be
  516. non-NULL and the @code{re_endp} member of the structure it points to
  517. must point to the printable name of an error code
  518. (e.g. ``REG_ECOLLATE''); in this case, the result in @var{errbuf} is the
  519. decimal representation of the numeric value of the error code (0 if the
  520. name is not recognized).  @code{REG_ITOA} and @code{REG_ATOI} are
  521. intended primarily as debugging facilities; they are extensions,
  522. compatible with but not specified by POSIX 1003.2, and should be used
  523. with caution in software intended to be portable to other systems.  Be
  524. warned also that they are considered experimental and changes are
  525. possible.
  526.  
  527. @subheading Return Value
  528.  
  529. The size of buffer needed to hold the message (including terminating
  530. @code{NUL}) is always returned, even if @var{errbuf_size} is zero.
  531.  
  532. @c --------------------------------------------------------------------------
  533.  
  534. @node regfree, string
  535. @subheading Syntax
  536.  
  537. @example
  538.  
  539. #include <sys/types.h>
  540. #include <regex.h>
  541.  
  542. void regfree(regex_t *preg);
  543.  
  544. @end example
  545.  
  546. @subheading Description
  547.  
  548. @code{regfree} frees any dynamically-allocated storage associated with
  549. the compiled RE pointed to by @var{preg}.  The remaining @code{regex_t}
  550. is no longer a valid compiled RE and the effect of supplying it to
  551. @code{regexec} or @code{regerror} is undefined.
  552.