const regex = /(?<="Core #3 VID",)\n "SensorValue": "[0-9]+(\,[0-9]+)?/gm;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('(?<="Core #3 VID",)\\n "SensorValue": "[0-9]+(\\,[0-9]+)?', 'gm')
const str = `[
{
"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
},`;
// Reset `lastIndex` if this regex is defined globally
// regex.lastIndex = 0;
let m;
while ((m = regex.exec(str)) !== null) {
// This is necessary to avoid infinite loops with zero-width matches
if (m.index === regex.lastIndex) {
regex.lastIndex++;
}
// The result can be accessed through the `m`-variable.
m.forEach((match, groupIndex) => {
console.log(`Found match, group ${groupIndex}: ${match}`);
});
}
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 JavaScript, please visit: https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Regular_Expressions