Strip ANSI Codes

Remove ANSI escape codes from a string.

Code

General
str.replace(/\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])/g, '');

Parameters

String with ANSI codes

Browser·fetch() may be limited by CORS

More JavaScript Snippets