Working with Unicode in Regular Expressions in PHP

The modifier u, which you have encountered before, forces the regular expression to work correctly with Unicode. In particular, it correctly processes Cyrillic strings:

php<?php
  preg_replace('#[а-яё]#u', '!', 'яяя ййй ёёё');
?>