GET /server HTTP/1.1
Upgrade: WebSocket
Connection: Upgrade
Host: localhost:8181
Origin: http://localhost:8080
Sec-WebSocket-Key1: 42100 1 W5V X170y ER
Sec-WebSocket-Key2: ~\\ 8 I4ms;34 l`1j5 V2h0
Q??6QK?
Im receiving the above message and using c# to extract the last set of caracters (Q??6QK?) using the following Regex:
Regex.Match(message, "\r\n\r\n(?<value>.*?)$", options).Groups["value"].Value;
But the result of the Regex is return the string terminator caracter like this:
Q??6QK?\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0
Why? What is wrong?
Your string contains nulls at the end. The problem is in the string you pass to the regex engine, not the regex engine itself.
Perhaps you can post the code that created the string. You are probably reading a little too much out of a byte[].