0

I'm trying to split a string by using ; as delimiter but not when it is escaped \;. The string can contain characters, numbers, and nested quotes. I'm currently using boost::algorithm::split_regex like so:

string data = "hello; world; 100444; \"Hello \\; world\";";
vector<string> data_vec;

boost::algorithm::split_regex( data_vec, data, boost::regex("[^\\\\];");

I have tried to use negation but that didn't have any effect. boost::regex("(?:[^\\\\]);")

Any suggestions? Thank you in advance.

0

1 Answer 1

2

You'll want to use negative lookbehind (?<!regex) like this

(?<!\\\\);

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.