PCRE
acronymKept in this browser · My desk
Stands for: Perl Compatible Regular Expressions
A C library of regular-expression functions with Perl's syntax and semantics, now in its second API, PCRE2, and the engine behind the regular expressions of NGINX, PHP and many other programs.
Philip Hazel wrote it at the University of Cambridge's computing service. PCRE2 is the revised API, forked from PCRE1, and the old library is obsolete and no longer maintained. NGINX needs it for regular expressions in location blocks and the rewrite module, and since 1.21.5 uses PCRE2 unless built with --without-pcre2. Its default dialect follows Perl 5, with options that come closer to JavaScript or Python, so a pattern tested in a browser can behave differently once it is in an NGINX location.
Also known as: pcre2, pcre1, perl compatible regular expressions
Sources
- PCRE2 manual, pcre2(3), last updated 22 February 2025 (read 2026-10-27): C functions with the same syntax and semantics as Perl, with a few differences; PCRE2 is the revised API, forked from PCRE1, and the old library is obsolete and no longer maintained; written by Philip Hazel of the University Computing Service, Cambridge
- PCRE2 project page (read 2026-10-27): BSD licence; the default dialect closely matches Perl 5, with flags to follow dialects such as JavaScript or Python more closely; the basis for regular expressions in languages including PHP and R
- nginx, Building nginx from Sources (read 2026-10-27): PCRE required for regular expressions in the location directive and the rewrite module; --without-pcre2 selects the original PCRE library instead of PCRE2 (1.21.5)