<?php preg_replace( string|array $pattern, string|array $replacement, string|array $subject, int $limit = -1, int &$count = null): string|array|null
<?php private function stripAnsi(string $text): string { $text = preg_replace('/\x1b([\[()])[;?0-9]*[0-9A-Za-z]/', "", $text); $text = preg_replace('/\x1b([\[()])[;?0-9]*[0-9A-Za-z]/', "", $text); $text = preg_replace('/[\x03|\x1a]/', "", $text); return $text;
<?php private function stripAnsi(string $text): string { $text = preg_replace('/\x1b([\[()])[;?0-9]*[0-9A-Za-z]/', "", $text); $text = preg_replace('/\x1b([\[()])[;?0-9]*[0-9A-Za-z]/', "", $text); $text = preg_replace('/[\x03|\x1a]/', "", $text); return $text; }
<?php { $text = preg_replace('/\x1b([\[()])[;?0-9]*[0-9A-Za-z]/', "", $text); $text = preg_replace('/\x1b([\[()])[;?0-9]*[0-9A-Za-z]/', "", $text); $text = preg_replace('/[\x03|\x1a]/', "", $text); return $text; }