0

The buffer string char *bufferString points to the first element of the following string:

BER Berman, Jane 06/29/91 Photography;Dance;Music\n

I'd like to parse each item of the topics last list of topics only and store them

What I've tried:

#define REGEX_TOPIC "^[a-zA-Z].*^[0-9/0-90-9/0-90-9+]"
char *topic;
topic = strstr(bufferString, REGEX_TOPIC);

Could you help me here?

Kaunteya
  • 3,107
  • 1
  • 35
  • 66
J. Berman
  • 484
  • 1
  • 6
  • 13
  • 2
    I'd start by using a `regex` evaluator rather than `strstr` to evaluate the expression against the the input data. – WhozCraig Feb 28 '13 at 04:09
  • `^[a-zA-Z].*^[0-9/0-90-9/0-90-9+]` Doesn't look well-formed. Which part(s) of `^[a-zA-Z].*^[0-9/0-90-9/0-90-9+]` are you trying to match? – johnsyweb Feb 28 '13 at 04:16

1 Answers1

6

The strstr() function locates the first occurrence of the null-terminated string s2 in the null-terminated string s1. It does not handle regular expressions.

For using regular expressions in C, see the answers to Regular expressions in C: examples?.

Community
  • 1
  • 1
johnsyweb
  • 136,902
  • 23
  • 188
  • 247