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?

2
  • 2
    I'd start by using a regex evaluator rather than strstr to evaluate the expression against the the input data. Commented Feb 28, 2013 at 4: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? Commented Feb 28, 2013 at 4:16

1 Answer 1

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?.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.