preg_replace

Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Perform a regular expression search and replace
<?php preg_replace(    string|array $pattern,    string|array $replacement,    string|array $subject,    int $limit = -1,    int &$count = null): string|array|null
<?php     $connection->on('data', function ($data) use ($connection, $socket) {


        $data = trim(preg_replace('/[^\w\d \.\,\-\!\?]/u', '', $data));




        if ($data === '') {
<?php                         Connector::uri($parts, $host, $ip)

                    )->then(null, function (\Exception $e) use ($uri) {

                        if ($e instanceof \RuntimeException) {

                            $message = \preg_replace('/^(Connection to [^ ]+)[&?]hostname=[^ &]+/', '$1', $e->getMessage());

                            $e = new \RuntimeException(

                                'Connection to ' . $uri . ' failed: ' . $message,

                                $e->getCode(),
<?php             $that->failureCount++;



            $message = \preg_replace('/^(Connection to [^ ]+)[&?]hostname=[^ &]+/', '$1', $e->getMessage());

            if (\strpos($ip, ':') === false) {

                $that->lastError4 = $message;

                $that->lastErrorFamily = 4;
<?php             });

        }, function (\Exception $e) use ($uri) {

            if ($e instanceof \RuntimeException) {

                $message = \preg_replace('/^Connection to [^ ]+/', '', $e->getMessage());

                $e = new \RuntimeException(

                    'Connection to ' . $uri . $message,

                    $e->getCode(),
<?php             $error = \error_get_last();

            $errstr = \preg_replace('#.*: #', '', $error['message']);

            $errno = self::errno($errstr);



            throw new \RuntimeException(
<?php         $server = new FdServer($fd, $loop);



        $port = preg_replace('/.*:/', '', stream_socket_get_name($socket, false));

        $this->assertEquals('tcp://[::1]:' . $port, $server->getAddress());

    }