<s>
Perl	B-Language
Compatible	I-Language
Regular	I-Language
Expressions	I-Language
(	O
PCRE	B-Language
)	O
is	O
a	O
library	B-Library
written	O
in	O
C	B-Language
,	O
which	O
implements	O
a	O
regular	B-Language
expression	I-Language
engine	O
,	O
inspired	O
by	O
the	O
capabilities	O
of	O
the	O
Perl	B-Language
programming	I-Language
language	I-Language
.	O
</s>
<s>
Philip	O
Hazel	O
started	O
writing	O
PCRE	B-Language
in	O
summer	O
1997	O
.	O
</s>
<s>
PCRE	B-Language
's	O
syntax	O
is	O
much	O
more	O
powerful	O
and	O
flexible	O
than	O
either	O
of	O
the	O
POSIX	O
regular	B-Language
expression	I-Language
flavors	O
(	O
BRE	O
,	O
ERE	O
)	O
and	O
than	O
that	O
of	O
many	O
other	O
regular-expression	O
libraries	O
.	O
</s>
<s>
While	O
PCRE	B-Language
originally	O
aimed	O
at	O
feature-equivalence	O
with	O
Perl	B-Language
,	O
the	O
two	O
implementations	O
are	O
not	O
fully	O
equivalent	O
.	O
</s>
<s>
During	O
the	O
PCRE	B-Language
7.x	O
and	O
Perl	B-Language
5.9.x	O
phase	O
,	O
the	O
two	O
projects	O
coordinated	O
development	O
,	O
with	O
features	O
being	O
ported	O
between	O
them	O
in	O
both	O
directions	O
.	O
</s>
<s>
In	O
2015	O
,	O
a	O
fork	O
of	O
PCRE	B-Language
was	O
released	O
with	O
a	O
revised	O
programming	O
interface	O
(	O
API	O
)	O
.	O
</s>
<s>
The	O
new	O
PCRE2	B-Language
code	O
(	O
the	O
10.xx	O
series	O
)	O
has	O
had	O
a	O
number	O
of	O
extensions	O
and	O
coding	O
improvements	O
and	O
is	O
where	O
development	O
takes	O
place	O
.	O
</s>
<s>
A	O
number	O
of	O
prominent	O
open-source	B-Application
programs	I-Application
,	O
such	O
as	O
the	O
Apache	B-Application
and	O
Nginx	B-Operating_System
HTTP	O
servers	O
,	O
and	O
the	O
PHP	B-Application
and	O
R	B-Language
scripting	O
languages	O
,	O
incorporate	O
the	O
PCRE	B-Language
library	B-Library
;	O
proprietary	O
software	O
can	O
do	O
likewise	O
,	O
as	O
the	O
library	B-Library
is	O
BSD-licensed	O
.	O
</s>
<s>
As	O
of	O
Perl	B-Language
5.10	O
,	O
PCRE	B-Language
is	O
also	O
available	O
as	O
a	O
replacement	O
for	O
Perl	B-Language
's	O
default	O
regular-expression	O
engine	O
through	O
the	O
module	O
.	O
</s>
<s>
The	O
library	B-Library
can	O
be	O
built	O
on	O
Unix	O
,	O
Windows	O
,	O
and	O
several	O
other	O
environments	O
.	O
</s>
<s>
PCRE2	B-Language
is	O
distributed	O
with	O
a	O
POSIX	O
C	B-Language
wrapper	O
,	O
several	O
test	O
programs	O
,	O
and	O
the	O
utility	O
program	O
that	O
is	O
built	O
in	O
tandem	O
with	O
the	O
library	B-Library
.	O
</s>
<s>
This	O
optional	O
feature	O
is	O
available	O
if	O
enabled	O
when	O
the	O
PCRE2	B-Language
library	B-Library
is	O
built	O
.	O
</s>
<s>
The	O
use	O
of	O
the	O
system	O
stack	O
for	O
backtracking	B-Algorithm
can	O
be	O
problematic	O
in	O
PCRE1	O
,	O
which	O
is	O
why	O
this	O
feature	O
of	O
the	O
implementation	O
was	O
changed	O
in	O
PCRE2	B-Language
.	O
</s>
<s>
The	O
problem	O
of	O
stack	B-Error_Name
overflow	I-Error_Name
,	O
which	O
came	O
up	O
regularly	O
with	O
PCRE1	O
,	O
is	O
no	O
longer	O
an	O
issue	O
with	O
PCRE2	B-Language
from	O
release	O
10.30	O
(	O
2017	O
)	O
.	O
</s>
<s>
Like	O
Perl	B-Language
,	O
PCRE2	B-Language
has	O
consistent	O
escaping	O
rules	O
:	O
any	O
non-alpha-numeric	O
character	O
may	O
be	O
escaped	O
to	O
mean	O
its	O
literal	O
value	O
by	O
prefixing	O
a	O
(	O
backslash	O
)	O
before	O
the	O
character	O
.	O
</s>
<s>
This	O
is	O
different	O
to	O
Perl	B-Language
,	O
which	O
gives	O
an	O
error	O
only	O
if	O
it	O
is	O
in	O
warning	O
mode	O
(	O
PCRE2	B-Language
does	O
not	O
have	O
a	O
warning	O
mode	O
)	O
.	O
</s>
<s>
In	O
basic	O
POSIX	O
regular	B-Language
expressions	I-Language
,	O
sometimes	O
backslashes	O
escaped	O
non-alpha-numerics	O
(	O
e.g.	O
</s>
<s>
For	O
example	O
,	O
matches	O
any	O
digit	O
exactly	O
as	O
would	O
in	O
POSIX	O
regular	B-Language
expressions	I-Language
.	O
</s>
<s>
The	O
default	O
is	O
to	O
attempt	O
the	O
longest	B-Application
match	I-Application
first	O
and	O
backtrack	O
through	O
shorter	O
matches	O
:	O
e.g.	O
</s>
<s>
Patterns	O
in	O
PCRE2	B-Language
can	O
match	O
these	O
properties	O
:	O
e.g.	O
</s>
<s>
Such	O
matching	O
is	O
slower	O
than	O
the	O
normal	O
(	O
ASCII-only	O
)	O
non-UCP	O
alternative	O
.	O
</s>
<s>
Note	O
that	O
the	O
UCP	O
option	O
requires	O
the	O
library	B-Library
to	O
have	O
been	O
built	O
to	O
include	O
Unicode	O
support	O
(	O
this	O
is	O
the	O
default	O
for	O
PCRE2	B-Language
)	O
.	O
</s>
<s>
Very	O
early	O
versions	O
of	O
PCRE1	O
supported	O
only	O
ASCII	B-Protocol
code	I-Protocol
.	O
</s>
<s>
PCRE2	B-Language
has	O
always	O
supported	O
all	O
three	O
UTF	O
encodings	O
.	O
</s>
<s>
When	O
PCRE	B-Language
is	O
compiled	O
,	O
a	O
newline	O
default	O
is	O
selected	O
.	O
</s>
<s>
Which	O
newline/linebreak	O
is	O
in	O
effect	O
affects	O
where	O
PCRE	B-Language
detects	O
line	O
beginnings	O
and	O
ends	O
(	O
in	O
multiline	O
mode	O
)	O
,	O
as	O
well	O
as	O
what	O
matches	O
dot	O
(	O
regardless	O
of	O
multiline	O
mode	O
,	O
unless	O
the	O
dotall	O
option	O
is	O
set	O
)	O
.	O
</s>
<s>
It	O
also	O
affects	O
PCRE	B-Language
matching	O
procedure	O
(	O
since	O
version	O
7.0	O
)	O
:	O
when	O
an	O
unanchored	O
pattern	O
fails	O
to	O
match	O
at	O
the	O
start	O
of	O
a	O
newline	O
sequence	O
,	O
PCRE	B-Language
advances	O
past	O
the	O
entire	O
newline	O
sequence	O
before	O
retrying	O
the	O
match	O
.	O
</s>
<s>
The	O
newline	O
option	O
can	O
be	O
altered	O
with	O
external	O
options	O
when	O
PCRE	B-Language
is	O
compiled	O
and	O
when	O
it	O
is	O
run	O
.	O
</s>
<s>
Some	O
applications	O
using	O
PCRE	B-Language
provide	O
users	O
with	O
the	O
means	O
to	O
apply	O
this	O
setting	O
through	O
an	O
external	O
option	O
.	O
</s>
<s>
See	O
below	O
for	O
configuration	O
and	O
options	O
concerning	O
what	O
matches	O
backslash-R	O
.	O
</s>
<s>
See	O
below	O
for	O
configuration	O
and	O
options	O
concerning	O
what	O
matches	O
backslash-R	O
.	O
</s>
<s>
When	O
PCRE	B-Language
is	O
compiled	O
,	O
a	O
default	O
is	O
selected	O
for	O
what	O
matches	O
.	O
</s>
<s>
The	O
backslash-R	O
options	O
also	O
can	O
be	O
changed	O
with	O
external	O
options	O
by	O
the	O
application	O
calling	O
PCRE2	B-Language
,	O
when	O
a	O
pattern	O
is	O
compiled	O
.	O
</s>
<s>
Linebreak	O
options	O
such	O
as	O
documented	O
above	O
;	O
backslash-R	O
options	O
such	O
as	O
documented	O
above	O
;	O
Unicode	O
Character	O
Properties	O
option	O
documented	O
above	O
;	O
option	O
documented	O
as	O
follows	O
:	O
if	O
your	O
PCRE2	B-Language
library	B-Library
has	O
been	O
compiled	O
with	O
UTF	O
support	O
,	O
you	O
can	O
specify	O
the	O
option	O
at	O
the	O
beginning	O
of	O
a	O
pattern	O
instead	O
of	O
setting	O
an	O
external	O
option	O
to	O
invoke	O
UTF-8	O
,	O
UTF-16	O
,	O
or	O
UTF-32	O
mode	O
.	O
</s>
<s>
Named	O
subpatterns	O
are	O
a	O
feature	O
that	O
PCRE	B-Language
adopted	O
from	O
Python	B-Language
regular	B-Language
expressions	I-Language
.	O
</s>
<s>
This	O
feature	O
was	O
subsequently	O
adopted	O
by	O
Perl	B-Language
,	O
so	O
now	O
named	O
groups	O
can	O
also	O
be	O
defined	O
using	O
or	O
,	O
as	O
well	O
as	O
.	O
</s>
<s>
Named	O
groups	O
can	O
be	O
backreferenced	O
with	O
,	O
for	O
example	O
:	O
(	O
Python	B-Language
syntax	O
)	O
or	O
(	O
Perl	B-Language
syntax	O
)	O
.	O
</s>
<s>
PCRE	B-Language
also	O
supports	O
a	O
non-Perl	O
Oniguruma	B-Algorithm
construct	O
for	O
subroutines	O
.	O
</s>
<s>
Atomic	O
grouping	O
is	O
a	O
way	O
of	O
preventing	O
backtracking	B-Algorithm
in	O
a	O
pattern	O
.	O
</s>
<s>
Look-behind	O
assertions	O
cannot	O
be	O
of	O
uncertain	O
length	O
though	O
(	O
unlike	O
Perl	B-Language
)	O
each	O
branch	O
can	O
be	O
a	O
different	O
fixed	O
length	O
.	O
</s>
<s>
PCRE	B-Language
expressions	O
can	O
embed	O
(	O
?	O
Cn	O
)	O
,	O
where	O
n	O
is	O
some	O
number	O
.	O
</s>
<s>
This	O
will	O
call	O
out	O
to	O
an	O
external	O
user-defined	O
function	O
through	O
the	O
PCRE	B-Language
API	O
and	O
can	O
be	O
used	O
to	O
embed	O
arbitrary	O
code	O
in	O
a	O
pattern	O
.	O
</s>
<s>
Differences	O
between	O
PCRE2	B-Language
and	O
Perl	B-Language
(	O
as	O
of	O
Perl	B-Language
5.9.4	O
)	O
include	O
but	O
are	O
not	O
limited	O
to	O
:	O
</s>
<s>
This	O
meant	O
that	O
would	O
match	O
in	O
Perl	B-Language
but	O
not	O
in	O
PCRE2	B-Language
until	O
release	O
10.30	O
.	O
</s>
<s>
In	O
Perl	B-Language
will	O
result	O
in	O
containing	O
"	O
a	O
"	O
and	O
containing	O
,	O
but	O
in	O
PCRE	B-Language
will	O
result	O
in	O
containing	O
"	O
b	O
"	O
.	O
</s>
<s>
This	O
means	O
that	O
is	O
unambiguous	O
in	O
Perl	B-Language
,	O
but	O
potentially	O
ambiguous	O
in	O
PCRE	B-Language
.	O
</s>
<s>
This	O
is	O
no	O
longer	O
a	O
difference	O
since	O
PCRE	B-Language
8.34	O
(	O
released	O
on	O
2013-12-15	O
)	O
,	O
which	O
no	O
longer	O
allows	O
group	O
names	O
to	O
start	O
with	O
a	O
digit	O
.	O
</s>
<s>
Within	O
lookbehind	O
assertions	O
,	O
both	O
PCRE	B-Language
and	O
Perl	B-Language
require	O
fixed-length	O
patterns	O
.	O
</s>
<s>
That	O
is	O
,	O
both	O
PCRE	B-Language
and	O
Perl	B-Language
disallow	O
variable-length	O
patterns	O
using	O
quantifiers	O
within	O
lookbehind	O
assertions	O
.	O
</s>
<s>
However	O
,	O
Perl	B-Language
requires	O
all	O
alternative	O
branches	O
of	O
a	O
lookbehind	O
assertion	O
to	O
be	O
the	O
same	O
length	O
as	O
each	O
other	O
,	O
whereas	O
PCRE	B-Language
allows	O
those	O
alternative	O
branches	O
to	O
have	O
different	O
lengths	O
from	O
each	O
other	O
as	O
long	O
as	O
each	O
branch	O
still	O
has	O
a	O
fixed	O
length	O
.	O
</s>
<s>
Recursion	O
control	O
verbs	O
added	O
in	O
the	O
Perl	B-Language
5.9.x	O
series	O
are	O
also	O
not	O
supported	O
.	O
</s>
<s>
Support	O
for	O
experimental	O
backtracking	B-Algorithm
control	O
verbs	O
(	O
added	O
in	O
Perl	B-Language
5.10	O
)	O
is	O
available	O
in	O
PCRE	B-Language
since	O
version	O
7.3	O
.	O
</s>
<s>
Perl	B-Language
's	O
corresponding	O
use	O
of	O
arguments	O
with	O
backtracking	B-Algorithm
control	O
verbs	O
is	O
not	O
generally	O
supported	O
.	O
</s>
<s>
Note	O
however	O
that	O
since	O
version	O
8.10	O
,	O
PCRE	B-Language
supports	O
the	O
following	O
verbs	O
with	O
a	O
specified	O
argument	O
:	O
,	O
,	O
,	O
and	O
.	O
</s>
<s>
Since	O
version	O
10.32	O
PCRE2	B-Language
has	O
supported	O
,	O
,	O
and	O
.	O
</s>
<s>
Perl	B-Language
allows	O
quantifiers	O
on	O
the	O
construct	O
,	O
which	O
is	O
meaningless	O
but	O
harmless	O
(	O
albeit	O
inefficient	O
)	O
;	O
PCRE	B-Language
produces	O
an	O
error	O
in	O
versions	O
before	O
8.13	O
.	O
</s>
<s>
With	O
default	O
build	O
options	O
will	O
fail	O
to	O
match	O
due	O
to	O
the	O
limit	O
,	O
but	O
Perl	B-Language
will	O
match	O
this	O
correctly	O
.	O
</s>
<s>
Perl	B-Language
uses	O
the	O
heap	O
for	O
recursion	O
and	O
has	O
no	O
hard	O
limit	O
for	O
recursion	O
depth	O
,	O
whereas	O
PCRE2	B-Language
has	O
a	O
compile-time	O
default	O
limit	O
that	O
can	O
be	O
adjusted	O
up	O
or	O
down	O
by	O
the	O
calling	O
application	O
.	O
</s>
<s>
With	O
the	O
exception	O
of	O
the	O
above	O
points	O
,	O
PCRE	B-Language
is	O
capable	O
of	O
passing	O
the	O
tests	O
in	O
the	O
Perl	B-Language
"	O
t/op/re_tests	O
"	O
file	O
,	O
one	O
of	O
the	O
main	O
syntax-level	O
regression	O
tests	O
for	O
Perl	B-Language
's	O
regular	B-Language
expression	I-Language
engine	O
.	O
</s>
