<s>
In	O
computer	B-General_Concept
science	I-General_Concept
,	O
an	O
algorithm	O
for	O
matching	B-Algorithm
wildcards	I-Algorithm
(	O
also	O
known	O
as	O
globbing	B-Language
)	O
is	O
useful	O
in	O
comparing	O
text	O
strings	O
that	O
may	O
contain	O
wildcard	B-Algorithm
syntax	I-Algorithm
.	O
</s>
<s>
Common	O
uses	O
of	O
these	O
algorithms	O
include	O
command-line	B-Application
interfaces	I-Application
,	O
e.g.	O
</s>
<s>
the	B-Device
Bourne	I-Device
shell	I-Device
or	O
Microsoft	B-Application
Windows	I-Application
command-line	B-Application
or	O
text	O
editor	O
or	O
file	O
manager	O
,	O
as	O
well	O
as	O
the	O
interfaces	O
for	O
some	O
search	O
engines	O
and	O
databases	O
.	O
</s>
<s>
Wildcard	B-Algorithm
matching	I-Algorithm
is	O
a	O
subset	O
of	O
the	O
problem	O
of	O
matching	O
regular	B-Language
expressions	I-Language
and	O
string	B-Algorithm
matching	I-Algorithm
in	O
general	O
.	O
</s>
<s>
A	O
wildcard	B-Algorithm
matcher	O
tests	O
a	O
wildcard	B-Algorithm
pattern	O
p	O
against	O
an	O
input	O
string	O
s	O
.	O
It	O
performs	O
an	O
anchored	O
match	O
,	O
returns	O
true	O
only	O
when	O
p	O
matches	O
the	O
entirety	O
of	O
s	O
.	O
</s>
<s>
The	O
pattern	O
can	O
be	O
based	O
on	O
any	O
common	O
syntax	O
(	O
see	O
globbing	B-Language
)	O
,	O
but	O
on	O
Windows	O
programmers	O
tend	O
to	O
only	O
discuss	O
a	O
simplified	O
syntax	O
supported	O
by	O
the	O
native	O
C	O
runtime	O
:	O
</s>
<s>
Wildcards	B-Algorithm
:	O
matches	O
exactly	O
one	O
occurrence	O
of	O
any	O
character	O
.	O
</s>
<s>
Stated	O
in	O
zero-based	O
indices	O
,	O
the	O
wildcard-matching	O
problem	O
can	O
be	O
defined	O
recursively	O
as	O
:	O
</s>
<s>
Directly	O
related	O
problems	O
in	O
computer	B-General_Concept
science	I-General_Concept
include	O
:	O
</s>
<s>
Pattern	B-Language
matching	I-Language
with	O
do	O
n't	O
cares	O
or	O
gaps	O
,	O
an	O
unanchored	O
string	B-Algorithm
search	I-Algorithm
with	O
only	O
the	O
equivalent	O
of	O
defined	O
.	O
</s>
<s>
Pattern	B-Language
matching	I-Language
with	O
wildcards	B-Algorithm
,	O
an	O
unanchored	O
string	B-Algorithm
search	I-Algorithm
with	O
the	O
equivalent	O
of	O
both	O
wildcards	B-Algorithm
defined	O
.	O
</s>
<s>
Has	O
an	O
exponential	O
runtime	O
unless	O
a	O
length-bound	O
is	O
given	O
in	O
the	O
pattern	B-Language
matching	I-Language
with	O
flexible	O
wildcards	B-Algorithm
variant	O
.	O
</s>
<s>
Early	O
algorithms	O
for	O
matching	B-Algorithm
wildcards	I-Algorithm
often	O
relied	O
on	O
recursion	O
,	O
but	O
the	O
technique	O
was	O
criticized	O
on	O
grounds	O
of	O
performance	O
and	O
reliability	O
considerations	O
.	O
</s>
<s>
Non-recursive	O
algorithms	O
for	O
matching	B-Algorithm
wildcards	I-Algorithm
have	O
gained	O
favor	O
in	O
light	O
of	O
these	O
considerations	O
.	O
</s>
<s>
Among	O
both	O
recursive	O
and	O
non-recursive	O
algorithms	O
,	O
strategies	O
for	O
performing	O
the	O
pattern	B-Language
matching	I-Language
operation	O
vary	O
widely	O
,	O
as	O
evidenced	O
among	O
the	O
variety	O
of	O
example	O
algorithms	O
referenced	O
below	O
.	O
</s>
<s>
This	O
is	O
a	O
form	O
of	O
backtracking	B-Algorithm
,	O
also	O
done	O
by	O
some	O
regular	B-Language
expression	I-Language
matchers	O
.	O
</s>
<s>
C	O
library	O
fnmatch	B-Language
implementations	O
(	O
supports	O
 [ ... ] 	O
and	O
multibyte	O
character	O
sets	O
)	O
:	O
</s>
<s>
This	O
is	O
seen	O
earlier	O
in	O
uwildmat	O
in	O
2000	O
and	O
more	O
implicitly	O
in	O
van	O
Rossum	O
's	O
fnmatch	B-Language
for	O
.	O
</s>
<s>
The	O
iterative	O
functions	O
above	O
implement	O
backtracking	B-Algorithm
by	O
saving	O
an	O
old	O
set	O
of	O
pattern/text	O
pointers	O
,	O
and	O
reverting	O
to	O
it	O
should	O
a	O
match	O
fails	O
.	O
</s>
<s>
In	O
addition	O
,	O
the	O
problem	O
of	O
wildcard	B-Algorithm
matching	I-Algorithm
can	O
be	O
converted	O
into	O
regular	B-Language
expression	I-Language
matching	O
using	O
a	O
naive	O
text-replacement	O
approach	O
.	O
</s>
<s>
Although	O
non-recursive	O
regular	B-Language
expression	I-Language
matchers	O
such	O
as	O
Thompson	B-General_Concept
's	I-General_Concept
construction	I-General_Concept
are	O
less	O
used	O
in	O
practice	O
due	O
to	O
lack	O
of	O
backreference	O
support	O
,	O
wildcard	B-Algorithm
matching	I-Algorithm
in	O
general	O
does	O
not	O
come	O
with	O
a	O
similarly	O
rich	O
set	O
of	O
features	O
.	O
</s>
<s>
The	O
Russ	O
Cox	O
implementation	O
of	O
Thompson	B-General_Concept
NFA	I-General_Concept
can	O
be	O
trivially	O
modified	O
for	O
such	O
.	O
</s>
