Reputation: 1
I have:
string cap = "OK|pz6u1";
var id = Regex.Match(cap, @"OK\|(.*?)").Groups[1].Value;
Why id is null?
Upvotes: 0
Views: 682
Reputation: 19830
change your code to below one:
var id = Regex.Match(cap, @"OK\|(.*)").Groups[1].Value
The problem in your expression was a question mark (?). Question mark mark makes the previous statement optional, so that is way it was omitted.
Upvotes: 1