Perl Compatible Regular Expressions

Perl Compatible Regular Expressions
Original author(s)Philip Hazel
Stable release(s)
PCRE18.45 / June 15, 2021; 3 years ago (2021-06-15)[1]
PCRE210.43 / February 16, 2024; 9 months ago (2024-02-16)[2]
Repository
Written inC
Operating systemCross-platform
TypePattern matching library
LicenseBSD
Websitepcre.org Edit this at Wikidata

Perl Compatible Regular Expressions (PCRE) is a library written in C, which implements a regular expression engine, inspired by the capabilities of the Perl programming language. Philip Hazel started writing PCRE in summer 1997.[3] PCRE's syntax is much more powerful and flexible than either of the POSIX regular expression flavors (BRE, ERE)[4] and than that of many other regular-expression libraries.

While PCRE originally aimed at feature-equivalence with Perl, the two implementations are not fully equivalent. During the PCRE 7.x and Perl 5.9.x phase, the two projects coordinated development, with features being ported between them in both directions.[5]

In 2015, a fork of PCRE was released with a revised programming interface (API). The original software, now called PCRE1 (the 1.xx–8.xx series), has had bugs mended, but no further development. As of 2020, it is considered obsolete, and the current 8.45 release is likely to be the last. The new PCRE2 code (the 10.xx series) has had a number of extensions and coding improvements and is where development takes place.

A number of prominent open-source programs, such as the Apache and Nginx HTTP servers, and the PHP and R scripting languages, incorporate the PCRE library; proprietary software can do likewise, as the library is BSD-licensed. As of Perl 5.10, PCRE is also available as a replacement for Perl's default regular-expression engine through the re::engine::PCRE module.

The library can be built on Unix, Windows, and several other environments. PCRE2 is distributed with a POSIX C wrapper,[Note 1] several test programs, and the utility program pcregrep/pcre2grep that is built in tandem with the library.

  1. ^ Cite error: The named reference PCRE1 was invoked but never defined (see the help page).
  2. ^ Cite error: The named reference PCRE2 was invoked but never defined (see the help page).
  3. ^ Cite error: The named reference 073dda77f8b5f8fd09647bddbdfd70bf was invoked but never defined (see the help page).
  4. ^ Cite error: The named reference e4ac0ff70c49a9478fa2d8c44bf2b644 was invoked but never defined (see the help page).
  5. ^ Cite error: The named reference 48c79c744a1d99fc5e30e1e948afbd20 was invoked but never defined (see the help page).


Cite error: There are <ref group=Note> tags on this page, but the references will not show without a {{reflist|group=Note}} template (see the help page).