# Regular Expressions

> Section in “New and Extended Functionality” of the book [PHP 7 Explained](https://php7explained.com/) by Sebastian Bergmann and Stefan Priebsch, published by thePHP.cc. The book covers PHP 7.0 to 7.4 and was last updated in November 2020. HTML version: <https://php7explained.com/new-and-extended-functionality/regular-expressions/>

## In this section

- [JIT Support for Regular Expressions](https://php7explained.com/new-and-extended-functionality/regular-expressions/jit-support-for-regular-expressions/index.html.md): PHP 7 enables the JIT compiler of the PCRE library, adds PREG_JIT_STACKLIMIT_ERROR for preg_last_error(), and allows disabling the JIT via pcre.jit.
- [PCRE 2](https://php7explained.com/new-and-extended-functionality/regular-expressions/pcre-2/index.html.md): Background on PCRE2, the redesigned library behind the preg_*() functions: stricter pattern validation, better error handling, and an expanded syntax.
- [preg_quote() and the # Character](https://php7explained.com/new-and-extended-functionality/regular-expressions/preg_quote-and-the-character/index.html.md): Since PHP 7.3, preg_quote() also prefixes the # character with a backslash, whereas PHP 7.2 and older left the # character unescaped.
- [preg_replace_callback_array()](https://php7explained.com/new-and-extended-functionality/regular-expressions/preg_replace_callback_array/index.html.md): The new preg_replace_callback_array() function takes an associative array of patterns and callbacks, so each regular expression gets its own callback.
- [Flags for preg_replace_callback() and preg_replace_callback_array()](https://php7explained.com/new-and-extended-functionality/regular-expressions/flags-for-preg_replace_callback-and-preg_replace_callback_array/index.html.md): Since PHP 7.4, preg_replace_callback() and preg_replace_callback_array() accept a flags argument with PREG_OFFSET_CAPTURE and PREG_UNMATCHED_AS_NULL.

---

Previous: [Array Argument for mb_convert_encoding()](https://php7explained.com/new-and-extended-functionality/internationalisation-and-unicode/array-argument-for-mb_convert_encoding/index.html.md) | Next: [JIT Support for Regular Expressions](https://php7explained.com/new-and-extended-functionality/regular-expressions/jit-support-for-regular-expressions/index.html.md)
