I would like to get some values from a string with Regex. I'll proceed to explain:
- There is a string: "Player #0 Agentep97 (12.34.56.78:1234) connected"
- I'd like to get the #[NUMBER], Username ("Agentep97"), ([IP]:[Port]) values
I already tried with var match = Regex.Match(input, @"Player #(?<player_id>[0-9]{1,3})\s(?<user>.+)\s\((<ip1>\d{1,3})\.(<ip2>\d{1,3})\.(<ip3>\d{1,3})\.(<ip4>\d{1,3})\:(<port>\d{1,5}$)\) connected\W\D\S", RegexOptions.IgnoreCase); but I the Match didn't succeed so I couldn't get player_id.Value and such.
How would you do it? Is "var match" not correct or anything?
Thanks in advance!