Menu Samaritan's Purse

PREG_QUOTE

Quote regular expression characters

The special regular expression characters are: . \ + * ? [ ^ ] $ ( ) { } = ! < > | : - #

Note that / is not a special regular expression character.

SYNTAX

preg_quote ( string $str [, string $delimiter = NULL ] ) : string

PARAMETERS

str

The input string.

delimiter

If the optional delimiter is specified, it will also be escaped. This is useful for escaping the delimiter that is required by the PCRE functions. The / is the most commonly used delimiter.

RETURN

Returns the quoted (escaped) string.

EXAMPLES

STR

\$40 for a g3/400

DELIMITER

\$40 for a g3\/400

ASTERISK

This book is <i>*very*</i> difficult to find.

PHP