Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Perform a regular expression search and replace
preg_replace(    string|array $pattern,    string|array $replacement,    string|array $subject,    int $limit = -1,    int &$count null): string|array|null
    protected function extractChannelKeys($pattern$channel)

    {

        
preg_match('/^'.preg_replace('/\{(.*?)\}/''(?<$1>[^\.]+)'$pattern).'/'$channel$keys);



        return 
$keys;

    }
    protected function channelNameMatchesPattern($channel$pattern)

    {

        return 
Str::is(preg_replace('/\{(.*?)\}/''*'$pattern), $channel);

    }

}
    public function cleanRateLimiterKey($key)

    {

        return 
preg_replace('/&([a-z])[a-z]+;/i''$1'htmlentities($key));

    }

}
            if (! $this->output->isVerbose()) {

                
$command str_replace([Application::phpBinary(), Application::artisanBinary()], [

                    
'php',

                    
preg_replace("#['\"]#"''Application::artisanBinary()),

                ], 
$event->command);

            }
            ));




            
$command preg_replace("#(php artisan [\w\-:]+) (.+)#"'$1 <fg=yellow;options=bold>$2</>'$command);



            return [
sprintf(

                
'  <fg=yellow>%s</>  %s<fg=#6C7280>%s %s%s %s</>',
    public function __invoke($string)

    {

        return 
preg_replace('/\[([^\]]+)\]/''<options=bold>[$1]</>', (string) $string);

    }

}
            Mutators\EnsureRelativePaths::class,

        ]);



        
$descriptionWidth mb_strlen(preg_replace("/\<[\w=#\/\;,:.&,%?]+\>|\\e\[\d+m/"'$1'$description) ?? '');



        
$this->output->write("  $description "false$verbosity);
    protected function wrapJsonPath($value$delimiter '->')

    {

        
$value preg_replace("/([\\\\]+)?\\'/""''"$value);



        
$jsonPath collect(explode($delimiter$value))

            ->
map(fn ($segment) =>  $this->wrapJsonPathSegment($segment))
            $alias ??= Str::snake(

                
preg_replace('/[^[:alnum:][:space:]_]/u'''"$name $function $column")

            );



            if (
$function === 'exists') {
    protected function removeLeadingBoolean($value)

    {

        return 
preg_replace('/and |or /i'''$value1);

    }
    protected function removeAutoIncrementingState(string $path)

    {

        
$this->files->put($pathpreg_replace(

            
'/\s+AUTO_INCREMENT=[0-9]+/iu',

            
'',

            
$this->files->get($path)

        ));

    }
    protected function makeListeners($event$listeners)

    {

        foreach (
$listeners as $listener) {

            
$listener preg_replace('/@.+$/'''$listener);



            
$this->callSilent('make:listener'array_filter(

                [
'name' => $listener'--event' => $event]
    protected function writeNewEnvironmentFileWith($key)

    {

        
file_put_contents($this->laravel->environmentFilePath(), preg_replace(

            
$this->keyReplacementPattern(),

            
'APP_KEY='.$key,

            
file_get_contents($this->laravel->environmentFilePath())

        ));

    }
            array_keys($replace), array_values($replace), $stub

        
);



        return 
preg_replace(

            
vsprintf('/use %s;[\r\n]+use %s;/', [

                
preg_quote($namespacedModel'/'),

                
preg_quote($namespacedModel'/'),

            ]),

            
"use {$namespacedModel};",

            
$stub

        
);

    }
                '  <fg=white;options=bold>%s</> %s<fg=white>%s</><fg=#6C7280>%s %s</>',

                
$method,

                
$spaces,

                
preg_replace('#({[^}]+})#''<fg=yellow>$1</>'$uri),

                
$dots,

                
str_replace('   '' › '$action ?? ''),

            ), 
$this->output->isVerbose() && ! empty($middleware) ? "<fg=#6C7280>$middleware</>" null];