Better regex for mono version parsing
This commit is contained in:
parent
0d112075cb
commit
502c2fa6cf
|
@ -10,7 +10,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||||
{
|
{
|
||||||
private readonly IRuntimeProvider _runtimeProvider;
|
private readonly IRuntimeProvider _runtimeProvider;
|
||||||
private readonly Logger _logger;
|
private readonly Logger _logger;
|
||||||
private static readonly Regex VersionRegex = new Regex(@"(?<=\W)(?<version>\d+\.\d+\.\d+(\.\d+)?)(?=\W)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
private static readonly Regex VersionRegex = new Regex(@"(?<=\W|^)(?<version>\d+\.\d+\.\d+(\.\d+)?)(?=\W)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||||
|
|
||||||
public MonoVersionCheck(IRuntimeProvider runtimeProvider, Logger logger)
|
public MonoVersionCheck(IRuntimeProvider runtimeProvider, Logger logger)
|
||||||
{
|
{
|
||||||
|
@ -25,7 +25,8 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||||
return new HealthCheck(GetType());
|
return new HealthCheck(GetType());
|
||||||
}
|
}
|
||||||
|
|
||||||
var versionMatch = VersionRegex.Match(_runtimeProvider.GetVersion());
|
var versionString = _runtimeProvider.GetVersion();
|
||||||
|
var versionMatch = VersionRegex.Match(versionString);
|
||||||
|
|
||||||
if (versionMatch.Success)
|
if (versionMatch.Success)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue