⊗ppPmRgLm 242 of 447 menu

Delimiters of Regular Expressions in PHP

Not only #, but also any other characters (except letters and digits) can act as delimiters. For example, let's take the ampersand symbols as delimiters:

<?php echo preg_replace('&а+&', '!', 'строка'); ?>

If brackets are used, then the left delimiter is the opening bracket, and the right one is the closing bracket:

<?php echo preg_replace('(а+)', '!', 'строка'); ?>

Use the tilde symbol ~ as delimiters.

byenru