using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"(?<=""Core #3 VID"",)\n ""SensorValue"": ""[0-9]+(\,[0-9]+)?";
string input = @"[
{
""SensorApp"": ""HWiNFO"",
""SensorClass"": ""System"",
""SensorName"": ""Virtual Memory Commited"",
""SensorValue"": ""31385"",
""SensorUnit"": ""MB"",
""SensorUpdateTime"": 1558534280
},
{
""SensorApp"": ""HWiNFO"",
""SensorClass"": ""System"",
""SensorName"": ""Virtual Memory Available"",
""SensorValue"": ""5951"",
""SensorUnit"": ""MB"",
""SensorUpdateTime"": 1558534280
},
{
""SensorApp"": ""HWiNFO"",
""SensorClass"": ""System"",
""SensorName"": ""Virtual Memory Load"",
""SensorValue"": ""84"",
""SensorUnit"": ""%"",
""SensorUpdateTime"": 1558534280
},
{
""SensorApp"": ""HWiNFO"",
""SensorClass"": ""System"",
""SensorName"": ""Physical Memory Used"",
""SensorValue"": ""30134"",
""SensorUnit"": ""MB"",
""SensorUpdateTime"": 1558534280
},
{
""SensorApp"": ""HWiNFO"",
""SensorClass"": ""System"",
""SensorName"": ""Physical Memory Available"",
""SensorValue"": ""2338"",
""SensorUnit"": ""MB"",
""SensorUpdateTime"": 1558534280
},
{
""SensorApp"": ""HWiNFO"",
""SensorClass"": ""System"",
""SensorName"": ""Physical Memory Load"",
""SensorValue"": ""92,7"",
""SensorUnit"": ""%"",
""SensorUpdateTime"": 1558534280
},
{
""SensorApp"": ""HWiNFO"",
""SensorClass"": ""System"",
""SensorName"": ""Page File Usage"",
""SensorValue"": ""27,2209569027549"",
""SensorUnit"": ""%"",
""SensorUpdateTime"": 1558534280
},
{
""SensorApp"": ""HWiNFO"",
""SensorClass"": ""CPU [#0]: Intel Xeon E3-1225 v3"",
""SensorName"": ""Core #0 VID"",
""SensorValue"": ""0,7376708984375"",
""SensorUnit"": ""V"",
""SensorUpdateTime"": 1558534280
},
{
""SensorApp"": ""HWiNFO"",
""SensorClass"": ""CPU [#0]: Intel Xeon E3-1225 v3"",
""SensorName"": ""Core #1 VID"",
""SensorValue"": ""0,73828125"",
""SensorUnit"": ""V"",
""SensorUpdateTime"": 1558534280
},
{
""SensorApp"": ""HWiNFO"",
""SensorClass"": ""CPU [#0]: Intel Xeon E3-1225 v3"",
""SensorName"": ""Core #2 VID"",
""SensorValue"": ""0,73828125"",
""SensorUnit"": ""V"",
""SensorUpdateTime"": 1558534280
},
{
""SensorApp"": ""HWiNFO"",
""SensorClass"": ""CPU [#0]: Intel Xeon E3-1225 v3"",
""SensorName"": ""Core #3 VID"",
""SensorValue"": ""0,7449951171875"",
""SensorUnit"": ""V"",
""SensorUpdateTime"": 1558534280
},
{
""SensorApp"": ""HWiNFO"",
""SensorClass"": ""CPU [#0]: Intel Xeon E3-1225 v3"",
""SensorName"": ""Core #0 Clock"",
""SensorValue"": ""983,934044334975"",
""SensorUnit"": ""MHz"",
""SensorUpdateTime"": 1558534280
},
{
""SensorApp"": ""HWiNFO"",
""SensorClass"": ""CPU [#0]: Intel Xeon E3-1225 v3"",
""SensorName"": ""Core #1 Clock"",
""SensorValue"": ""983,934044334975"",
""SensorUnit"": ""MHz"",
""SensorUpdateTime"": 1558534280
},
{
""SensorApp"": ""HWiNFO"",
""SensorClass"": ""CPU [#0]: Intel Xeon E3-1225 v3"",
""SensorName"": ""Core #2 Clock"",
""SensorValue"": ""983,934044334975"",
""SensorUnit"": ""MHz"",
""SensorUpdateTime"": 1558534280
},";
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