parsing/matching string occurrence in C

Posted by David on Stack Overflow See other posts from Stack Overflow or by David
Published on 2010-04-10T17:32:10Z Indexed on 2010/04/10 17:43 UTC
Read the original article Hit count: 230

Filed under:
|
|

I have the following string:

const char *str = "\"This is just some random text\" 130 28194 \"Some other string\" \"String 3\""

I would like to get the the integer 28194 of course the integer varies, so I can't do strstr("20194").

So I was wondering what would be a good way to get that part of the string?

I was thinking to use #include <regex.h> which I already have a procedure to match regexp's but not sure how the regexp in C will look like using the POSIX style notation. [:alpha:]+[:digit:] and if performance will be an issue. Or will it be better using strchr,strstr?

Any ideas will be appreciate it

© Stack Overflow or respective owner

Related posts about c

    Related posts about regex