regular expressions

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: sinck@ugive.comsinckugive.com
Date:  
Subject: regular expressions

\_ Ok, I was confused, the rx library is included by default in glibc. The
\_ problem I am having is the following:
\_
\_ To use the regex functions, I have to create a structure, regex_t. If i
\_ just declare it like this:
\_
\_ struct regex_t rx;
\_
\_ The compiler errors out saying "storage size of `rx' isn't known".
\_
\_ Can anyone give me some pointers on how to malloc this thing?

Well, there's the ever popular:

    #include <regex.h>
    regex_t *prx;
    prx = (regex_t *)malloc(sizeof(regex_t)); 


which compiles sans error on my box (with some other fluff) (once I
remembered the parens...woe to the wicked perl language that made me
forget my early joys of Lisp matched & balanced parenthesization).



\_ Thanks (and sorry for the double post).
\_
\_ On Mon, 19 Feb 2001 17:08:39 Julian M Catchen wrote:
\_ > Does anyone have any experience using a regular expression library with a
\_ > C
\_ > program? I am trying to use GNU's rx library but its documentation is a
\_ > little lacking. Anyone have any experience with this (pointers to docs
\_ > or
\_ > any other help)? Should I be using a different library instead?

For a good presentation on regexen, there's _Mastering Regular
Expressions_ by Jeffrey Friedl pub'd by ORA. It rocks, but it isn't
for the faint of heart.

David