I\'m trying to match the parts of a version number (Major.Minor.Build.Revision) with C# regular expressions. However, I\'m pretty new to writing Regex and even using Expresso is
Above answer not working properly
(?\d*)\.(?\d*)(\.(?\d*)(\.(?\d*))?)?
try this one,
var regularExpression = @"^(\d+\.)?(\d+\.)?(\d+\.)?(\*|\d+)$"; var regex = Regex.IsMatch("1.0.0.0", regularExpression, RegexOptions.IgnoreCase | RegexOptions.CultureInvariant); Console.WriteLine(regex);