I was parsing the Playwright JSON report using a separate script. In that script, I used the regex \x1B\[(?:;?[0-9]{1,3})+[mGK], mentioned in a comment to this StackOverflow answer, to replace the ANSI color characters.
\x1B\[(?:;?[0-9]{1,3})+[mGK]