From 20e06b84332da41f66e9c83fd9ccba464023eb67 Mon Sep 17 00:00:00 2001 From: Pavel Shevaev Date: Wed, 26 Feb 2025 09:50:51 +0300 Subject: [PATCH] Fixing new lines preserving for one line comments --- jsm.inc.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/jsm.inc.php b/jsm.inc.php index 125349f..6de4cb9 100644 --- a/jsm.inc.php +++ b/jsm.inc.php @@ -254,9 +254,8 @@ class JSM { if(strpos($txt, '/*') === false) return $txt; - $regex = '~/\*.*?\*/~s'; $txt = preg_replace_callback( - $regex, + '~/\*.*?\*/~s', //preserve the new lines for better error reporting function($m) { return str_repeat("\n", substr_count($m[0], "\n")); }, $txt); @@ -266,7 +265,11 @@ class JSM private static function _removeLineComments(string $txt) : string { //TODO: it's not robust enough, note a hack for URL addresses - $txt = preg_replace("~\s*(?