using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"%utilization\"",.+:\""(?<utilization>[\d\.]+)";
string input = @"Dataframe row : {""_c0"":{""0"":null,""1"":""00:00:01"",""2"":""13:30:01""},""_c1"":{""0"":null,""1"":""CPU"",""2"":""all""},""_c2"":{""0"":""Linux"",""1"":""%user"",""2"":""1.05""},""_c3"":{""0"":""3.10.0-1160.76.1.el7.x86_64"",""1"":""%nice"",""2"":""0.34""},""_c4"":{""0"":""(fraasdwhbdd1.de.db.com)"",""1"":""%system"",""2"":""0.83""},""_c5"":{""0"":""16\/05\/23"",""1"":""%iowait"",""2"":""0.05""},""_c6"":{""0"":""_x86_64_"",""1"":""%steal"",""2"":""0.00""},""_c7"":{""0"":""(8"",""1"":""%idle"",""2"":""97.73""},""_c8"":{""0"":""CPU)"",""1"":""%utilization"",""2"":""2.27""}}.";
RegexOptions options = RegexOptions.Multiline;
foreach (Match m in Regex.Matches(input, pattern, options))
{
Console.WriteLine("'{0}' found at index {1}.", m.Value, m.Index);
}
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for C#, please visit: https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex(v=vs.110).aspx