Example
Consider this as “messageString”
Call answered at: Thu Jun 29 2023 21:37:26 GMT+0000 (GMT)
Call ended at: Thu Jun 29 2023 21:37:44 GMT+0000 (GMT)
Duration of the call: 00:00:18
PBX: rspsupply
Username: RSPSupply.Brandon.Mizar
Call Id: 1683756226953
Direction: OutboundCall
Caller Name: Hoffman Factory
Caller Record Id: 1326736
Caller Phone: +17634222211
From this message, how to display the value of “Duration of the call”
const durationRegex = /Duration of the call: (\d{2}:\d{2}:\d{2})/;
const match = durationRegex.exec(messageString);
if (match) {
const duration = match[1];
console.log("Duration of the call:", duration);
} else {
console.log("Duration not found in the message string.");
}