From 285ce0831fdb617916cac6249dd36c56802e5598 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Thu, 25 Jun 2026 13:25:39 +0900 Subject: fix(console): spell ESC as \x1b for regex crate in HtmlOutputFormatter Co-Authored-By: Claude Opus 4.8 (1M context) --- crates/shirabe/src/console/html_output_formatter.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/shirabe/src/console/html_output_formatter.rs b/crates/shirabe/src/console/html_output_formatter.rs index 4ee87a1..cfb2f21 100644 --- a/crates/shirabe/src/console/html_output_formatter.rs +++ b/crates/shirabe/src/console/html_output_formatter.rs @@ -57,8 +57,11 @@ impl HtmlOutputFormatter { }; let clear_escape_codes = "(?:39|49|0|22|24|25|27|28)"; + // Regex pattern compatibility: + // The PHP pattern writes the ESC byte as the octal escape `\033`; the `regex` crate reads + // `\0` as a backreference, so spell ESC as `\x1b` instead. let pattern = format!( - "{{\\033\\[([0-9;]+)m(.*?)\\033\\[(?:{};)*?{}m}}s", + "{{\\x1b\\[([0-9;]+)m(.*?)\\x1b\\[(?:{};)*?{}m}}s", clear_escape_codes, clear_escape_codes ); -- cgit v1.3.1