$re = '/^\[([\d]{1,2}-[\w]{3,9}-[\d]{4}\s+[\d]{2}:[\d]{2}:[\d]{2}\s+[A-Z]{3,4})\]\s((?s).+?)(?=(?:^\[.+\])|\Z)/m';
$str = '[27-May-2021 05:59:39 UTC] Inpsyde\\Idealo\\WooCommerce\\IdealoException: Plugin "woocommerce" must be installed and active in C:\\Users\\xedin\\Local Sites\\idealo\\app\\public\\wp-content\\plugins\\idealo-for-woocommerce\\src\\Application.php:172
[27-May-2021 05:59:39 UTC] PHP Fatal error: Uncaught Error: Class \'ActionScheduler_Lock\' not found in C:\\Users\\xedin\\Local Sites\\idealo\\app\\public\\wp-content\\plugins\\idealo-for-woocommerce\\vendor\\woocommerce\\action-scheduler\\classes\\abstracts\\ActionScheduler.php:29
Stack trace:
#0 C:\\Users\\xedin\\Local Sites\\idealo\\app\\public\\wp-content\\plugins\\idealo-for-woocommerce\\vendor\\woocommerce\\action-scheduler\\classes\\ActionScheduler_QueueRunner.php(103): ActionScheduler::lock()
#1 C:\\Users\\xedin\\Local Sites\\idealo\\app\\public\\wp-includes\\class-wp-hook.php(292): ActionScheduler_QueueRunner->maybe_dispatch_async_request(\'\')
#2 C:\\Users\\xedin\\Local Sites\\idealo\\app\\public\\wp-includes\\class-wp-hook.php(316): WP_Hook->apply_filters(NULL, Array)
#3 C:\\Users\\xedin\\Local Sites\\idealo\\app\\public\\wp-includes\\plugin.php(484): WP_Hook->do_action(Array)
#4 C:\\Users\\xedin\\Local Sites\\idealo\\app\\public\\wp-includes\\load.php(1072): do_action(\'shutdown\')
#5 [internal function]: shutdown_action_hook()
#6 {main}
thrown in C:\\Users\\xedin\\Local Sites\\idealo\\app\\public\\wp-content\\plugins\\idealo-for-woocommerce\\vendor\\woocommerce\\action-scheduler\\classes\\abstracts\\ActionScheduler.php on line 29
[27-May-2021 05:59:39 UTC] PHP Stack trace:
[27-May-2021 05:59:39 UTC] PHP 1. {main}() C:\\Users\\xedin\\Local Sites\\idealo\\app\\public\\wp-admin\\admin-ajax.php:0
[27-May-2021 05:59:39 UTC] PHP 2. do_action() C:\\Users\\xedin\\Local Sites\\idealo\\app\\public\\wp-admin\\admin-ajax.php:187
[27-May-2021 05:59:39 UTC] PHP 3. WP_Hook->do_action() C:\\Users\\xedin\\Local Sites\\idealo\\app\\public\\wp-includes\\plugin.php:484
[27-May-2021 05:59:39 UTC] PHP 4. WP_Hook->apply_filters() C:\\Users\\xedin\\Local Sites\\idealo\\app\\public\\wp-includes\\class-wp-hook.php:316
[27-May-2021 05:59:39 UTC] PHP 5. wp_ajax_delete_plugin() C:\\Users\\xedin\\Local Sites\\idealo\\app\\public\\wp-includes\\class-wp-hook.php:292
[27-May-2021 05:59:39 UTC] PHP 6. wp_send_json_success() C:\\Users\\xedin\\Local Sites\\idealo\\app\\public\\wp-admin\\includes\\ajax-actions.php:4591
[27-May-2021 05:59:39 UTC] PHP 7. wp_send_json() C:\\Users\\xedin\\Local Sites\\idealo\\app\\public\\wp-includes\\functions.php:4151
[27-May-2021 05:59:39 UTC] PHP 8. wp_die() C:\\Users\\xedin\\Local Sites\\idealo\\app\\public\\wp-includes\\functions.php:4125
[27-May-2021 05:59:39 UTC] PHP 9. _ajax_wp_die_handler() C:\\Users\\xedin\\Local Sites\\idealo\\app\\public\\wp-includes\\functions.php:3421
[27-May-2021 06:56:26 UTC] PHP Warning: mysqli_real_connect(): (HY000/2002): No connection could be made because the target machine actively refused it.
in C:\\Users\\xedin\\Local Sites\\idealo\\app\\public\\wp-includes\\wp-db.php on line 1653
[27-May-2021 06:56:27 UTC] PHP Stack trace:
[27-May-2021 06:56:27 UTC] PHP 1. {main}() C:\\Users\\xedin\\Local Sites\\idealo\\app\\public\\wp-cron.php:0
[27-May-2021 06:56:27 UTC] PHP 2. require_once() C:\\Users\\xedin\\Local Sites\\idealo\\app\\public\\wp-cron.php:44
[27-May-2021 06:56:27 UTC] PHP 3. require_once() C:\\Users\\xedin\\Local Sites\\idealo\\app\\public\\wp-load.php:37
[27-May-2021 06:56:27 UTC] PHP 4. require_once() C:\\Users\\xedin\\Local Sites\\idealo\\app\\public\\wp-config.php:80
[27-May-2021 06:56:27 UTC] PHP 5. require_wp_db() C:\\Users\\xedin\\Local Sites\\idealo\\app\\public\\wp-settings.php:124
[27-May-2021 06:56:27 UTC] PHP 6. wpdb->__construct() C:\\Users\\xedin\\Local Sites\\idealo\\app\\public\\wp-includes\\load.php:545
[27-May-2021 06:56:27 UTC] PHP 7. wpdb->db_connect() C:\\Users\\xedin\\Local Sites\\idealo\\app\\public\\wp-includes\\wp-db.php:632
[27-May-2021 06:56:27 UTC] PHP 8. mysqli_real_connect() C:\\Users\\xedin\\Local Sites\\idealo\\app\\public\\wp-includes\\wp-db.php:1653
';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);
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 PHP, please visit: http://php.net/manual/en/ref.pcre.php