const regex = /(\w{3}\s\s\d{1,2} \d{2}:\d{2}:\d{2})\s(\S*)\s(\S*):\s\[(\S*)\]\s\[(\w\d{6})\]\s(\S*)\.(\w*):\s(.*)[\s|\s\[]({.*})/gm;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('(\\w{3}\\s\\s\\d{1,2} \\d{2}:\\d{2}:\\d{2})\\s(\\S*)\\s(\\S*):\\s\\[(\\S*)\\]\\s\\[(\\w\\d{6})\\]\\s(\\S*)\\.(\\w*):\\s(.*)[\\s|\\s\\[]({.*})', 'gm')
const str = `Feb 5 23:30:09 netoapi-06ae0d2a778f6d96c neto-ecommerce[21749]: [Self=1-5c5a1c7f-1417875ef90160804e31a159;Root=1-5c5a1c78-c849bf9b2a5aa92ee1ffd501] [N015185] app.ERROR: Entity of type 'Neto\\ShopBundle\\Entity\\Country' for IDs code() was not found [] {""tags"":[""sales_channels""]}"
Feb 5 23:10:00 cpanel-0b75ea0f831a1a35a neto-ecommerce[4987]: [Self=1-5c5a17c8-1b0a7d58cd923b42ff5a7412;Root=1-5c5a17c8-5432af944896f7d093992b3a] [N008907] app.ERROR: Uncaught PHP Exception Symfony\\Component\\HttpKernel\\Exception\\AccessDeniedHttpException: ""Installation wizard is not supported for Amazon AU"" at /opt/release/Neto6.38.0/vendor/php/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php line 117 {""exception"":""[object] (Symfony\\\\Component\\\\HttpKernel\\\\Exception\\\\AccessDeniedHttpException(code: 0): Installation wizard is not supported for Amazon AU at /opt/release/Neto6.38.0/vendor/php/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php:117, Symfony\\\\Component\\\\Security\\\\Core\\\\Exception\\\\AccessDeniedException(code: 403): Installation wizard is not supported for Amazon AU at /opt/release/Neto6.38.0/vendor/php/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerTrait.php:379)""} {""tags"":[""sales_channels""]}"
Feb 5 21:35:06 netoapi-050acc5cb696746e7 neto-ecommerce[31278]: [Self=1-5c5a0188-c0db1f2809ade66c634f9576;Root=1-5c5a0185-b02bf3209835c7a4df7e5c2c] [N015185] app.ERROR: Entity of type 'Neto\\ShopBundle\\Entity\\Country' for IDs code() was not found [] {""tags"":[""sales_channels""]}"
Feb 6 05:59:30 netoapi-07743f4e14561df22 neto-ecommerce[5407]: [Self=1-5c5a77c1-0019eb7067e6cc30180f9770;Root=1-5c5a77a7-2fa7f778122a1698c2a7e286] [N016687] app.CRITICAL: Uncaught PHP Exception Doctrine\\DBAL\\Exception\\DriverException: "An exception occured in driver: SQLSTATE[HY000] [1203] User N016687_web already has more than 'max_user_connections' active connections" at /opt/release/Neto6.38.0/vendor/php/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 115 {"exception":"[object] (Doctrine\\\\DBAL\\\\Exception\\\\DriverException(code: 0): An exception occured in driver: SQLSTATE[HY000] [1203] User N016687_web already has more than 'max_user_connections' active connections at /opt/release/Neto6.38.0/vendor/php/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:115, Doctrine\\\\DBAL\\\\Driver\\\\PDOException(code: 1203): SQLSTATE[HY000] [1203] User N016687_web already has more than 'max_user_connections' active connections at /opt/release/Neto6.38.0/vendor/php/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:47, PDOException(code: 1203): SQLSTATE[HY000] [1203] User N016687_web already has more than 'max_user_connections' active connections at /opt/release/Neto6.38.0/vendor/php/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:43)"} {"tags":["sales_channels"]}`;
// 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