preg_match

Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Perform a regular expression match
<?php preg_match(    string $pattern,    string $subject,    array &$matches = null,    int $flags = 0,    int $offset = 0): int|false
<?php     private function getFullyQualifiedDefinitionName(SplFileInfo $file): ?string

    {

        if (preg_match('/namespace (.*);/', $file->getContents(), $matches)) {


            $fullyQualifiedName = $matches[1].'\\'.$file->getFilenameWithoutExtension();
<?php     private function takeSuggestions(array $suggestions): array

    {

        $suggestions = array_filter($suggestions,

            fn (string $suggestion): bool => in_array(preg_match('/[^a-zA-Z]/', $suggestion), [0, false], true)

        );



        return array_slice(array_values(array_unique($suggestions)), 0, 4);
<?php     $output = $process->getOutput();



    preg_match('/Duration: ([0-9.]+)s/', $output, $matches);

    $output = str_replace($matches[1], '0.00', $output);



    expect($exitCode)->toBe(1)
<?php     $output = $process->getOutput();



    preg_match('/Duration: ([0-9.]+)s/', $output, $matches);

    $output = str_replace($matches[1], '0.00', $output);



    expect($exitCode)->toBe(0)