my string looks like this:
abcd "efgh [data\]" pqrl 12fgd]
I want to parse till ‘]’ which is not proceeded by a backslash ‘\’
Can I do it with strtok_r? If not than how should I do it?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There is no one shot method to doing this using
strtok_r. Since your delimiter is a single character you can always reconstruct the string you want by stuffing back the delimiter if the last character of a token returned bystrtok_ris ‘\’.This outputs: