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 getOracleMysqlVersionNumber(string $versionString): string
{
if (
preg_match(
'/^(?P<major>\d+)(?:\.(?P<minor>\d+)(?:\.(?P<patch>\d+))?)?/',
$versionString,
$versionParts
) === 0
) {
throw Exception::invalidPlatformVersionSpecified(
$versionString,
<?php private function getMariaDbMysqlVersionNumber(string $versionString): string
{
if (
preg_match(
'/^(?:5\.5\.5-)?(mariadb-)?(?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)/i',
$versionString,
$versionParts
) === 0
) {
throw Exception::invalidPlatformVersionSpecified(
$versionString,
<?php public function createDatabasePlatformForVersion($version)
{
if (preg_match('/^(?P<major>\d+)(?:\.(?P<minor>\d+)(?:\.(?P<patch>\d+))?)?/', $version, $versionParts) === 0) {
throw Exception::invalidPlatformVersionSpecified(
$version,
'<major_version>.<minor_version>.<patch_version>'
<?php throw Error::new($this->dbh);
}
assert(preg_match('/\s+(\d+\.\d+\.\d+\.\d+\.\d+)\s+/', $version, $matches) === 1);
return $matches[1];
}
<?php public static function assertValidIdentifier($identifier)
{
if (preg_match('(^(([a-zA-Z]{1}[a-zA-Z0-9_$#]{0,})|("[^"]+"))$)', $identifier) === 0) {
throw new Exception('Invalid Oracle identifier');
}
}
<?php return $query;
}
if (preg_match('/^\s*SELECT/i', $query) === 1) {
if (preg_match('/\sFROM\s/i', $query) === 0) {
$query .= ' FROM dual';
}
<?php }
if (preg_match('/^\s*SELECT/i', $query) === 1) {
if (preg_match('/\sFROM\s/i', $query) === 0) {
$query .= ' FROM dual';
}
<?php }
if ($this->shouldAddOrderBy($query)) {
if (preg_match('/^SELECT\s+DISTINCT/im', $query) > 0) {
<?php public function extractDoctrineTypeFromComment($comment, $currentType)
{
if ($comment !== null && preg_match('(\(DC2Type:(((?!\)).)+)\))', $comment, $match) === 1) {
return $match[1];
}
<?php if ($tableColumn['default'] !== null && $tableColumn['default'] !== 'NULL') {
$default = $tableColumn['default'];
if (preg_match('/^\'(.*)\'$/s', $default, $matches) === 1) {
$default = str_replace("''", "'", $matches[1]);
}
}
<?php case 'numeric':
case 'decimal':
if (
preg_match(
'([A-Za-z]+\(([0-9]+),([0-9]+)\))',
$tableColumn['type'],
$match
) === 1
) {
$precision = $match[1];
$scale = $match[2];
<?php return null;
}
if (preg_match('/^\'(.*)\'$/', $columnDefault, $matches) === 1) {
return strtr($matches[1], self::MARIADB_ESCAPE_SEQUENCES);
}
<?php if ($tableColumn['data_default'] !== null) {
if (preg_match('/^\'(.*)\'$/s', $tableColumn['data_default'], $matches) === 1) {
$tableColumn['data_default'] = str_replace("''", "'", $matches[1]);
}
}
<?php private function getQuotedIdentifierName($identifier)
{
if (preg_match('/[a-z]/', $identifier) === 1) {
return $this->_platform->quoteIdentifier($identifier);
}
<?php $onDelete = null;
if (
preg_match(
'(ON UPDATE ([a-zA-Z0-9]+( (NULL|ACTION|DEFAULT))?))',
$tableForeignKey['condef'],
$match
) === 1
) {
$onUpdate = $match[1];
}