const regex = /((?<syslog_pri>(^\<\d*\>))|(^(?<facility>[^\.]*)\.(?<severity>[^\s]*)))?\s*(?:%{SYSLOGTIMESTAMP:timestamp}|%{TIMESTAMP_ISO8601:timestamp}) %{SYSLOGHOST:iporhost}(?<messgae>.*)/g;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('((?<syslog_pri>(^\\<\\d*\\>))|(^(?<facility>[^\\.]*)\\.(?<severity>[^\\s]*)))?\\s*(?:%{SYSLOGTIMESTAMP:timestamp}|%{TIMESTAMP_ISO8601:timestamp}) %{SYSLOGHOST:iporhost}(?<messgae>.*)', 'g')
const str = `<165>
User.Notice 2016-01-02 00:00:33 1.1.66.15 1.1.66.15 02/01/2016 00:00:00 NTP: Synchronization OK.
Local7.Warning 2016-01-02 00:00:43 1.1.5.6 319129: 14w1d: %CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN mismatch discovered on GigabitEthernet1/0/21 (780), with name_a FastEthernet3 (1).
`;
const subst = ``;
// The substituted value will be contained in the result variable
const result = str.replace(regex, subst);
console.log('Substitution result: ', result);
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