In C, how do you capture a group with regex?

Posted by Sylvain on Stack Overflow See other posts from Stack Overflow or by Sylvain
Published on 2010-04-05T06:28:12Z Indexed on 2010/04/05 6:33 UTC
Read the original article Hit count: 294

Filed under:
|
|

Hi,

I'm trying to extract a string from another using regex. I'm using the POSIX regex functions (regcomp, regexec ...), and I fail at capturing a group ...

For instance, let the pattern be something as simple as "MAIL FROM:<(.*)>"
(with REG_EXTENDED cflags)

I want to capture everything between '<' and '>'

My problem is that regmatch_t gives me the boundaries of the whole pattern (MAIL FROM:<...>) instead of just what's between the parenthesis ...

What am I missing ?

Thanks in advance,

© Stack Overflow or respective owner

Related posts about c

    Related posts about regex