-3

I need find all occurrences of sequence: \r\n(some hex number)\r\n and delete this sequences from my string. Hexadecimal number doesn't start with 0x or x. It's just 20bb for example.

These sequences are chunks in http 1.1 protocol. I can't find them with string.find, maybe some regex would help.

Thanks for help.

0

1 Answer 1

0

From the code here I made this:

 std::string string("\r\n20BB\r\n"); string = std::regex_replace(string, std::regex("\r\n[0-9A-Fa-f]+\r\n"), ""); 

It should work. The [0-9A-Fa-f]+ captures one or more hex digits.

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.