diff --git a/src/Probel.Lanceur.Core/Entities/Query.cs b/src/Probel.Lanceur.Core/Entities/Query.cs index 85ca1bc..a0db747 100644 --- a/src/Probel.Lanceur.Core/Entities/Query.cs +++ b/src/Probel.Lanceur.Core/Entities/Query.cs @@ -1,5 +1,6 @@ using Probel.Lanceur.Core.Services; using System; +using System.Text.RegularExpressions; namespace Probel.Lanceur.Core.Entities { @@ -121,12 +122,12 @@ public void SetParameters(string cmdline) if (string.IsNullOrEmpty(cmdline)) { throw new ArgumentException($"The command line should NOT be empty or null", nameof(cmdline)); } var (_, @params) = Split(cmdline); + var regex = new Regex("^[a-zA-Z0-9]{1,}"); - Parameters = string.IsNullOrEmpty(@params) + Parameters = string.IsNullOrEmpty(@params) && !regex.IsMatch(Name.Trim()) ? cmdline.Replace(Name.Trim(), "") : @params; - } - + } public override string ToString() => $"{(Name ?? string.Empty)} {Parameters}"; #endregion Methods