\Regex

Represents an immutable regular expression.To browse the .NET Framework source code for this type, see the Reference Source.

Summary

Methods
Properties
Constants
Match()
Matches()
Replace()
Split()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

Match()

Match(string  $input, string  $pattern,   $options = PREG_PATTERN_ORDER,   $flags = null) : string

Searches the input string for the first occurrence of the specified regular expression, using the specified matching options.

Parameters

string $input

The string to search for a match.

string $pattern

The regular expression pattern to match.

$options
$flags

Returns

string —

An object that contains information about the match.

Matches()

Matches(string  $input, string  $pattern, integer  $options = PREG_PATTERN_ORDER,   $flags = null) : array

Searches the specified input string for all occurrences of a specified regular expression, using the specified matching options.

Parameters

string $input

The string to search for a match.

string $pattern

The regular expression pattern to match.

integer $options

A bitwise combination of the enumeration values that specify options for matching.

$flags

Returns

array —

A collection of the System.Text.RegularExpressions.Match objects found by the search. If no matches are found, the method returns an empty collection object.

Replace()

Replace(string  $input, string  $pattern, string  $replacement) : string

In a specified input string, replaces all strings that match a specified regular expression with a specified replacement string.

Parameters

string $input

The string to search for a match.

string $pattern

The regular expression pattern to match.

string $replacement

The replacement string.

Returns

string —

A new string that is identical to the input string, except that the replacement string takes the place of each matched string. If pattern is not matched in the current instance, the method returns the current instance unchanged.

Split()

Split(  $input,   $pattern) 

Parameters

$input
$pattern