preg_match

Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Perform a regular expression match
preg_match(    string $pattern,    string $subject,    array &$matches null,    int $flags 0,    int $offset 0): int|false
    private static function downloadVendorArchive(string $s3Stringstring $downloadPath): void

    
{

        
preg_match('~s3\:\/\/([^\/]+)\/(.*)~'$s3String$matches);

        
$bucket $matches[1];

        
$filePath '/' $matches[2];

        
$region getenv('AWS_REGION');
    private static function downloadVendorArchive(string $s3Stringstring $downloadPath): void

    
{

        
preg_match('~s3\:\/\/([^\/]+)\/(.*)~'$s3String$matches);

        
$bucket $matches[1];

        
$filePath '/' $matches[2];

        
$region getenv('AWS_REGION');
    private static function downloadVendorArchive(string $s3Stringstring $downloadPath): void

    
{

        
preg_match('~s3\:\/\/([^\/]+)\/(.*)~'$s3String$matches);

        
$bucket $matches[1];

        
$filePath '/' $matches[2];

        
$region getenv('AWS_REGION');
function assertMatchesRegex(string $expectedstring $actual)

{

    if (
preg_match($expected$actual) === false) {

        throw new 
Exception("$actual does not match regex $expected");

    }

}
        $serverlessInfoOutput $serverlessInfo->getOutput();



        
$region = [];

        
preg_match('/region: ([a-z0-9-]*)/'$serverlessInfoOutput$region);

        
$region $region[1];



        
$stack = [];
        $region $region[1];



        
$stack = [];

        
preg_match('/stack: ([a-zA-Z0-9-]*)/'$serverlessInfoOutput$stack);

        
$stack $stack[1];



        
$io->writeln("Stack: <fg=yellow>$stack ($region)</>");
        $contextBuilder = new ContextBuilder;

        
curl_setopt($this->curlHandleNextCURLOPT_HEADERFUNCTION, function ($ch$header) use ($contextBuilder) {

            if (! 
preg_match('/:\s*/'$header)) {

                return 
strlen($header);

            }

            [
$name$value] = preg_split('/:\s*/'$header2);
        } else {

            
$result null;


            
preg_match('/REPORT RequestId: [^\n]*(.*)/s'$stderr$matches);

            
$error trim($matches[1] ?? '');

            if (
$error !== '') {

                
$result json_decode($errortrue512JSON_THROW_ON_ERROR);
        }




        
$return preg_match('/START RequestId: .*REPORT RequestId: [^\n]*/s'$stderr$matches);

        
$logs $return $matches[0] : $stderr;



        return [
$result$logs];