php8.5
Home/ Manual/ bson / regex/ MongoDB\BSON\Regex::getPattern

MongoDB\BSON\Regex::getPattern

PHP function Edit on GitHub ✎

(mongodb >=1.0.0)

Returns the Regex's pattern

Description

MongoDB\BSON\Regex::getPattern(): string

Parameters Parameters

Return Values

Returns the Regex's pattern.

Errors/Exceptions

Examples

MongoDB\BSON\Regex::getPattern() example

php
<?php

$regex = new MongoDB\BSON\Regex('regex', 'i');
var_dump($regex->getPattern());

?>

The above example will output something similar to:

output
string(5) "regex"

See Also

  • BSON Types

Source: reference/mongodb/bson/regex/getpattern.xml · from the official PHP manual (php/doc-en)