mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-23 00:55:57 +00:00
TextFormat: make clean() less confusing, deduplicate some regex
This commit is contained in:
parent
e1bacb5c6d
commit
6f36fa504b
@ -88,7 +88,7 @@ abstract class TextFormat{
|
||||
public static function clean(string $string, bool $removeFormat = true) : string{
|
||||
$string = mb_scrub($string, 'UTF-8');
|
||||
if($removeFormat){
|
||||
return str_replace(TextFormat::ESCAPE, "", preg_replace(["/" . TextFormat::ESCAPE . "[0-9a-fk-or]/u", "/\x1b[\\(\\][[0-9;\\[\\(]+[Bm]/u"], "", $string));
|
||||
$string = str_replace(TextFormat::ESCAPE, "", preg_replace("/" . TextFormat::ESCAPE . "[0-9a-fk-or]/u", "", $string));
|
||||
}
|
||||
return str_replace("\x1b", "", preg_replace("/\x1b[\\(\\][[0-9;\\[\\(]+[Bm]/u", "", $string));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user