4 ms·
\r?\n regex?
by nojvek 8y ago
\r?\n regex?
- bmn__ 8y agoNo, you want \R, the generic Unicode linebreak sequence. http://pcre.org/current/doc/html/pcre2pattern.html#newlineseq http://pcre.org/current/doc/html/pcre2pattern.html#newlinese... http://p3rl.org/rebackslash#\R http://p3rl.org/rebackslash#\R
- marcosdumay 8y agoSo, you take a `\r` from the network. So, do you wait for a `\n` before returning the line?
- rhencke 8y agoYou wait to peek the next byte, or EOF, and then make the choice.
- marcosdumay 8y agoLine protocols do not transmit EOF (and the problem is on each line anyway). And the next byte may only come after you write something on the socket.