I am searching a string for a pattern that matches
Material=. Some examples are
I am new to C# and I learned about capture groups but I am wondering if its possible to do it in a cleaner way?
var pattern = new Regex("(?<label>Material)=(?<value>[^,]+)"); Match match = pattern.Match(Row2.Attributes); var materialCode = (match.Success) ? match.Groups["value"].Value : "NA";
materialCode into a database so it can't be null. If a value isn't found it has to be "NA". Also there are lots of combos which is why I specify I need whatever value after the
= but before the
, in the regex