using System.Collections.Generic;
using System.Diagnostics;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
public static void Main()
var ssbpowoffset_cmd="set beampattern 0 ss-pbchindex=1 beamset-index=1 power=-3.5dB";
decimal ssbpowoffset_val ;
var targetStr = ssbpowoffset_cmd.Split(' ').FirstOrDefault(str => str.Contains(key)) ?? string.Empty;
var Match = new Regex(@"^\D*?((-?(\d+(\.\d+)?))|(-?\.\d+)).*").Match(targetStr);
ssbpowoffset_val = Match.Success ? Convert.ToDecimal(Match.Groups[1].Value) : 0;
Console.WriteLine(targetStr);
Console.WriteLine(Match);
Console.WriteLine(ssbpowoffset_val);