Dobrý den, potřebuji poradit... Ze hry mi přijde status v tomto strašném formátu: num score ping guid name lastmsg address qport rate #--- ----- ---- -------------------------------- --------------- ------- --------------------- ----- ----- # 4 0 23 blablablabfa218d4be29e7168c637be ^1XLR^78^9or[^7^7 0 135.94.165.296:63564 25313 25000 Vy pythonu funguje tento regexp _regPlayer = re.compile(r'^(?P<slot>[0-9]+)\s+(?P<score>[0-9-]+)\s+(?P<ping>[0-9]+)\s+(?P<guid>[a-z0-9]+)\s+(?P<name>.*?)\s+(?P<last>[0-9]+)\s+(?P<ip>[0-9.]+):(?P<port>[0-9-]+)\s+(?P<qport>[0-9-]+)\s+(?P<rate>[0-9]+)$', re.I) Match m = Regex.Match(hraci[i], @"^(?P<slot>[0-9]+\s+(?P<score>[0-9-]+\s+(?P<ping>[0-9]+\s+(?P<guid>[a-z0-9]+\s+(?P<name>.*?\s+(?P<last>[0-9]+\s+(?P<ip>[0-9.]+:(?P<port>[0-9-]+\s+(?P<qport>[0-9-]+\s+(?P<rate>[0-9])", RegexOptions.IgnoreCase); Když to převedu do C#, tak to ale nejde Match m = Regex.Match(radek, @"^(?P<slot>[0-9]+)\s+(?P<score>[0-9-]+)\s+(?P<ping>[0-9]+)\s+(?P<guid>[a-z0-9]+)\s+(?P<name>.*?)\s+(?P<last>[0-9]+)\s+(?P<ip>[0-9.]+):(?P<port>[0-9-]+)\s+(?P<qport>[0-9-]+)\s+(?P<rate>[0-9]+)$", RegexOptions.IgnoreCase); Console.WriteLine(m.Groups.Count); Console.WriteLine(m.Groups["ip"].Value);
|