<s>
In	O
computer	B-General_Concept
programming	I-General_Concept
,	O
glob	B-Language
(	O
)	O
patterns	O
specify	O
sets	O
of	O
filenames	O
with	O
wildcard	B-Algorithm
characters	I-Algorithm
.	O
</s>
<s>
For	O
example	O
,	O
the	O
Unix	B-Application
Bash	B-Operating_System
shell	I-Operating_System
command	O
moves	O
(	O
)	O
all	O
files	O
with	O
names	O
ending	O
in	O
.txt	O
from	O
the	O
current	O
directory	O
to	O
the	O
directory	O
textfiles	O
.	O
</s>
<s>
Here	O
,	O
*	O
is	O
a	O
wildcard	B-Algorithm
standing	O
for	O
"	O
any	O
string	O
of	O
characters	O
except	O
/	O
"	O
and	O
*	O
.txt	O
is	O
a	O
glob	B-Language
pattern	I-Language
.	O
</s>
<s>
The	O
other	O
common	O
wildcard	B-Algorithm
is	O
the	O
question	O
mark	O
(	O
?	O
</s>
<s>
In	O
addition	O
to	O
matching	O
filenames	O
,	O
globs	B-Language
are	O
also	O
used	O
widely	O
for	O
matching	O
arbitrary	O
strings	O
(	O
wildcard	B-Algorithm
matching	I-Algorithm
)	O
.	O
</s>
<s>
In	O
this	O
capacity	O
a	O
common	O
interface	O
is	O
fnmatch	B-Language
.	O
</s>
<s>
The	O
glob	B-Language
command	O
,	O
short	O
for	O
global	O
,	O
originates	O
in	O
the	O
earliest	O
versions	O
of	O
Bell	O
Labs	O
 '	O
Unix	B-Application
.	O
</s>
<s>
The	O
command	O
interpreters	O
of	O
the	O
early	O
versions	O
of	O
Unix	B-Application
(	O
1st	O
through	O
6th	O
Editions	O
,	O
1969	O
–	O
1975	O
)	O
relied	O
on	O
a	O
separate	O
program	O
to	O
expand	O
wildcard	B-Algorithm
characters	I-Algorithm
in	O
unquoted	O
arguments	O
to	O
a	O
command	O
:	O
/etc/glob	O
.	O
</s>
<s>
Glob	B-Language
was	O
originally	O
written	O
in	O
the	O
B	B-Language
programming	I-Language
language	I-Language
.	O
</s>
<s>
It	O
was	O
the	O
first	O
piece	O
of	O
mainline	O
Unix	B-Application
software	O
to	O
be	O
developed	O
in	O
a	O
high-level	B-Language
programming	I-Language
language	I-Language
.	O
</s>
<s>
Later	O
,	O
this	O
functionality	O
was	O
provided	O
as	O
a	O
C	O
library	B-Library
function	I-Library
,	O
glob( )	O
,	O
used	O
by	O
programs	O
such	O
as	O
the	O
shell	B-Operating_System
.	O
</s>
<s>
It	O
is	O
usually	O
defined	O
based	O
on	O
a	O
function	O
named	O
fnmatch( )	O
,	O
which	O
tests	O
for	O
whether	O
a	O
string	O
matches	O
a	O
given	O
pattern	O
-	O
the	O
program	O
using	O
this	O
function	O
can	O
then	O
iterate	O
through	O
a	O
series	O
of	O
strings	O
(	O
usually	O
filenames	O
)	O
to	O
determine	O
which	O
ones	O
match	O
.	O
</s>
<s>
The	O
idea	O
of	O
defining	O
a	O
separate	O
match	O
function	O
started	O
with	O
wildmat	B-Algorithm
(	O
wildcard	B-Algorithm
match	O
)	O
,	O
a	O
simple	O
library	O
to	O
match	O
strings	O
against	O
Bourne	B-Device
Shell	I-Device
globs	B-Language
.	O
</s>
<s>
Traditionally	O
,	O
globs	B-Language
do	O
not	O
match	O
hidden	B-Application
files	I-Application
in	O
the	O
form	O
of	O
Unix	B-Application
dotfiles	B-Application
;	O
to	O
match	O
them	O
the	O
pattern	O
must	O
explicitly	O
start	O
with	O
..	O
For	O
example	O
,	O
*	O
matches	O
all	O
visible	O
files	O
while	O
.	O
</s>
<s>
*	O
matches	O
all	O
hidden	B-Application
files	I-Application
.	O
</s>
<s>
The	O
most	O
common	O
wildcards	B-Algorithm
are	O
,	O
,	O
and	O
.	O
</s>
<s>
Wildcard	B-Algorithm
Description	O
Example	O
Matches	O
Does	O
not	O
match	O
matches	O
any	O
number	O
of	O
any	O
characters	O
including	O
none	O
,	O
,	O
or	O
,	O
,	O
or	O
,	O
,	O
or	O
.	O
</s>
<s>
Normally	O
,	O
the	O
path	O
separator	O
character	O
(	O
on	O
Linux/Unix	O
,	O
MacOS	O
,	O
etc	O
.	O
</s>
<s>
Some	O
shells	O
,	O
such	O
as	O
Bash	B-Operating_System
have	O
functionality	O
allowing	O
users	O
to	O
circumvent	O
this	O
.	O
</s>
<s>
On	O
Unix-like	B-Operating_System
systems	I-Operating_System
,	O
is	O
defined	O
as	O
above	O
while	O
has	O
two	O
additional	O
meanings	O
:	O
</s>
<s>
Wildcard	B-Algorithm
Description	O
Example	O
Matches	O
Does	O
not	O
match	O
matches	O
one	O
character	O
that	O
is	O
not	O
given	O
in	O
the	O
bracket	O
,	O
,	O
or	O
matches	O
one	O
character	O
that	O
is	O
not	O
from	O
the	O
range	O
given	O
in	O
the	O
bracket	O
,	O
,	O
up	O
to	O
and	O
etc	O
.	O
</s>
<s>
They	O
are	O
defined	O
to	O
match	O
up	O
with	O
the	O
brackets	O
in	O
POSIX	O
regular	B-Language
expressions	I-Language
.	O
</s>
<s>
Unix	B-Application
globbing	B-Language
is	O
handled	O
by	O
the	O
shell	B-Operating_System
per	O
POSIX	O
tradition	O
.	O
</s>
<s>
Globbing	B-Language
is	O
provided	O
on	O
filenames	O
at	O
the	O
command	B-Application
line	I-Application
and	O
in	O
shell	B-Language
scripts	I-Language
.	O
</s>
<s>
The	O
POSIX-mandated	O
case	O
statement	O
in	O
shells	O
provides	O
pattern-matching	O
using	O
glob	B-Language
patterns	I-Language
.	O
</s>
<s>
Some	O
shells	O
(	O
such	O
as	O
the	O
C	B-Operating_System
shell	I-Operating_System
and	O
Bash	B-Operating_System
)	O
support	O
additional	O
syntax	O
known	O
as	O
alternation	O
or	O
brace	O
expansion	O
.	O
</s>
<s>
Because	O
it	O
is	O
not	O
part	O
of	O
the	O
glob	B-Language
syntax	O
,	O
it	O
is	O
not	O
provided	O
in	O
case	O
.	O
</s>
<s>
It	O
is	O
only	O
expanded	O
on	O
the	O
command	B-Application
line	I-Application
before	O
globbing	B-Language
.	O
</s>
<s>
The	O
Bash	B-Operating_System
shell	I-Operating_System
also	O
supports	O
the	O
following	O
extensions	O
:	O
</s>
<s>
Extended	O
globbing	B-Language
(	O
extglob	O
)	O
:	O
allows	O
other	O
pattern	O
matching	O
operators	O
to	O
be	O
used	O
to	O
match	O
multiple	O
occurrences	O
of	O
a	O
pattern	O
enclosed	O
in	O
parentheses	O
,	O
essentially	O
providing	O
the	O
missing	O
kleene	O
star	O
and	O
alternation	O
for	O
describing	O
regular	B-General_Concept
languages	I-General_Concept
.	O
</s>
<s>
It	O
can	O
be	O
enabled	O
by	O
setting	O
the	O
shell	B-Operating_System
option	O
.	O
</s>
<s>
The	O
GNU	O
fnmatch	B-Language
and	O
glob	B-Language
has	O
an	O
identical	O
extension	O
.	O
</s>
<s>
Also	O
supported	O
by	O
the	O
JS	O
libraries	O
and	O
Python	B-Language
's	O
glob	B-Language
.	O
</s>
<s>
The	O
original	O
DOS	B-Device
was	O
a	O
clone	O
of	O
CP/M	B-Application
designed	O
to	O
work	O
on	O
Intel	O
's	O
8088	B-Device
and	O
8086	B-General_Concept
processors	O
.	O
</s>
<s>
Windows	O
shells	O
,	O
following	O
DOS	B-Device
,	O
do	O
not	O
traditionally	O
perform	O
any	O
glob	B-Language
expansion	O
in	O
arguments	O
passed	O
to	O
external	O
programs	O
.	O
</s>
<s>
Windows	B-Application
PowerShell	I-Application
has	O
all	O
the	O
common	O
syntax	O
defined	O
as	O
stated	O
above	O
without	O
any	O
additions	O
.	O
</s>
<s>
COMMAND.COM	B-Operating_System
and	O
cmd.exe	B-Device
have	O
most	O
of	O
the	O
common	O
syntax	O
with	O
some	O
limitations	O
:	O
There	O
is	O
no	O
and	O
for	O
COMMAND.COM	B-Operating_System
the	O
may	O
only	O
appear	O
at	O
the	O
end	O
of	O
the	O
pattern	O
.	O
</s>
<s>
Windows	O
and	O
DOS	B-Device
programs	O
receive	O
a	O
long	O
command-line	B-Application
string	O
instead	O
of	O
argv-style	O
parameters	O
,	O
and	O
it	O
is	O
their	O
responsibility	O
to	O
perform	O
any	O
splitting	O
,	O
quoting	O
,	O
or	O
glob	B-Language
expansion	O
.	O
</s>
<s>
There	O
is	O
technically	O
no	O
fixed	O
way	O
of	O
describing	O
wildcards	B-Algorithm
in	O
programs	O
since	O
they	O
are	O
free	O
to	O
do	O
what	O
they	O
wish	O
.	O
</s>
<s>
Two	O
common	O
glob	B-Language
expanders	O
include	O
:	O
</s>
<s>
The	O
Microsoft	O
C	O
Runtime	O
(	O
msvcrt	O
)	O
command-line	B-Application
expander	O
,	O
which	O
only	O
supports	O
and	O
.	O
</s>
<s>
Both	O
ReactOS	B-Application
(	O
crt/misc/getargs.c	O
)	O
and	O
Wine	B-Application
(	O
msvcrt/data.c	O
)	O
contain	O
a	O
compatible	O
open-source	O
implementation	O
of	O
,	O
the	O
function	O
operating	O
under-the-hood	O
,	O
in	O
their	O
core	O
CRT	O
.	O
</s>
<s>
The	O
Cygwin	B-Language
and	O
MSYS	O
command-line	B-Application
expander	O
,	O
which	O
uses	O
the	O
unix-style	B-Operating_System
routine	O
under-the-hood	O
,	O
after	O
splitting	O
the	O
arguments	O
.	O
</s>
<s>
Most	O
other	O
parts	O
of	O
Windows	O
,	O
including	O
the	O
Indexing	O
Service	O
,	O
use	O
the	O
MS-DOS	O
style	O
of	O
wildcards	B-Algorithm
found	O
in	O
CMD	B-Device
.	O
</s>
<s>
Internally	O
this	O
is	O
done	O
using	O
three	O
extra	O
wildcard	B-Algorithm
characters	I-Algorithm
,	O
.	O
</s>
<s>
(	O
Another	O
fnmatch	B-Language
analogue	O
is	O
.	O
)	O
</s>
<s>
The	O
SQL	B-Language
operator	O
has	O
an	O
equivalent	O
to	O
and	O
but	O
not	O
.	O
</s>
<s>
Standard	O
SQL	B-Language
uses	O
a	O
glob-like	O
syntax	O
for	O
simple	O
string	O
matching	O
in	O
its	O
LIKE	O
operator	O
,	O
although	O
the	O
term	O
"	O
glob	B-Language
"	O
is	O
not	O
generally	O
used	O
in	O
the	O
SQL	B-Language
community	O
.	O
</s>
<s>
Many	O
implementations	O
of	O
SQL	B-Language
have	O
extended	O
the	O
LIKE	O
operator	O
to	O
allow	O
a	O
richer	O
pattern-matching	O
language	O
,	O
incorporating	O
character	O
ranges	O
(	O
)	O
,	O
their	O
negation	O
,	O
and	O
elements	O
of	O
regular	B-Language
expressions	I-Language
.	O
</s>
<s>
Globs	B-Language
do	O
not	O
include	O
syntax	O
for	O
the	O
Kleene	O
star	O
which	O
allows	O
multiple	O
repetitions	O
of	O
the	O
preceding	O
part	O
of	O
the	O
expression	O
;	O
thus	O
they	O
are	O
not	O
considered	O
regular	B-Language
expressions	I-Language
,	O
which	O
can	O
describe	O
the	O
full	O
set	O
of	O
regular	B-General_Concept
languages	I-General_Concept
over	O
any	O
given	O
finite	O
alphabet	O
.	O
</s>
<s>
Globs	B-Language
attempt	O
to	O
match	O
the	O
entire	O
string	O
(	O
for	O
example	O
,	O
matches	O
S.DOC	O
and	O
SA.DOC	O
,	O
but	O
not	O
POST.DOC	O
or	O
SURREY.DOCKS	O
)	O
,	O
whereas	O
,	O
depending	O
on	O
implementation	O
details	O
,	O
regular	B-Language
expressions	I-Language
may	O
match	O
a	O
substring	O
.	O
</s>
<s>
The	O
original	O
Mozilla	O
proxy	B-Protocol
auto-config	I-Protocol
implementation	O
,	O
which	O
provides	O
a	O
glob-matching	O
function	O
on	O
strings	O
,	O
uses	O
a	O
replace-as-RegExp	O
implementation	O
as	O
above	O
.	O
</s>
<s>
The	O
bracket	O
syntax	O
happens	O
to	O
be	O
covered	O
by	O
regex	B-Language
in	O
such	O
an	O
example	O
.	O
</s>
<s>
Python	B-Language
's	O
fnmatch	B-Language
uses	O
a	O
more	O
elaborate	O
procedure	O
to	O
transform	O
the	O
pattern	O
into	O
a	O
regular	B-Language
expression	I-Language
.	O
</s>
<s>
Beyond	O
their	O
uses	O
in	O
shells	O
,	O
globs	B-Language
patterns	O
also	O
find	O
use	O
in	O
a	O
variety	O
of	O
programming	O
languages	O
,	O
mainly	O
to	O
process	O
human	O
input	O
.	O
</s>
<s>
A	O
glob-style	O
interface	O
for	O
returning	O
files	O
or	O
an	O
fnmatch-style	O
interface	O
for	O
matching	O
strings	O
are	O
found	O
in	O
the	O
following	O
programming	O
languages	O
:	O
</s>
<s>
C#	B-Application
has	O
multiple	O
libraries	O
available	O
through	O
NuGet	B-Application
such	O
as	O
Glob	B-Language
.	O
</s>
<s>
or	O
DotNet.Glob	O
.	O
</s>
<s>
D	B-Application
has	O
a	O
globMatch	O
function	O
in	O
the	O
std.path	O
module	O
.	O
</s>
<s>
JavaScript	B-Language
has	O
a	O
library	O
called	O
minimatch	O
which	O
is	O
used	O
internally	O
by	O
npm	B-Language
,	O
and	O
micromatch	O
,	O
a	O
purportedly	O
more	O
optimized	O
,	O
accurate	O
and	O
safer	O
globbing	B-Language
implementation	O
used	O
by	O
Babel	B-Language
and	O
yarn	O
.	O
</s>
<s>
Go	B-Application
has	O
a	O
Glob	B-Language
function	O
in	O
the	O
filepath	O
package	O
.	O
</s>
<s>
Java	B-Language
has	O
a	O
Files	O
class	O
containing	O
methods	O
that	O
operate	O
on	O
glob	B-Language
patterns	I-Language
.	O
</s>
<s>
Haskell	B-Language
has	O
a	O
Glob	B-Language
package	O
with	O
the	O
main	O
module	O
System.FilePath.Glob	O
.	O
</s>
<s>
The	O
pattern	O
syntax	O
is	O
based	O
on	O
a	O
subset	O
of	O
Zsh	B-Application
’s	O
.	O
</s>
<s>
Perl	B-Language
has	O
both	O
a	O
glob	B-Language
function	O
(	O
as	O
discussed	O
in	O
Larry	O
Wall	O
's	O
book	O
Programming	O
Perl	B-Language
)	O
and	O
a	O
Glob	B-Language
extension	O
which	O
mimics	O
the	O
BSD	B-Operating_System
glob	B-Language
routine	O
.	O
</s>
<s>
Perl	B-Language
's	O
angle	O
brackets	O
can	O
be	O
used	O
to	O
glob	B-Language
as	O
well	O
:	O
<*.log>	O
.	O
</s>
<s>
PHP	B-Application
has	O
a	O
glob	B-Language
function	O
.	O
</s>
<s>
Python	B-Language
has	O
a	O
glob	B-Language
module	O
in	O
the	O
standard	O
library	O
which	O
performs	O
wildcard	B-Algorithm
pattern	O
matching	O
on	O
filenames	O
,	O
and	O
an	O
fnmatch	B-Language
module	O
with	O
functions	O
for	O
matching	O
strings	O
or	O
filtering	O
lists	O
based	O
on	O
these	O
same	O
wildcard	B-Algorithm
patterns	O
.	O
</s>
<s>
Guido	O
van	O
Rossum	O
,	O
author	O
of	O
the	O
Python	B-Language
programming	I-Language
language	I-Language
,	O
wrote	O
and	O
contributed	O
a	O
glob	B-Language
routine	O
to	O
BSD	B-Operating_System
Unix	I-Operating_System
in	O
1986	O
.	O
</s>
<s>
There	O
were	O
previous	O
implementations	O
of	O
glob	B-Language
,	O
e.g.	O
,	O
in	O
the	O
ex	B-Device
and	O
ftp	B-Protocol
programs	O
in	O
previous	O
releases	O
of	O
BSD	B-Operating_System
.	O
</s>
<s>
Ruby	B-Language
has	O
a	O
glob	B-Language
method	O
for	O
the	O
Dir	B-Device
class	O
which	O
performs	O
wildcard	B-Algorithm
pattern	O
matching	O
on	O
filenames	O
.	O
</s>
<s>
Several	O
libraries	O
such	O
as	O
Rant	O
and	O
Rake	O
provide	O
a	O
FileList	O
class	O
which	O
has	O
a	O
glob	B-Language
method	O
or	O
use	O
the	O
method	O
FileList	O
.	O
</s>
<s>
Rust	B-Application
has	O
multiple	O
libraries	O
that	O
can	O
match	O
glob	B-Language
patterns	I-Language
.	O
</s>
<s>
SQLite	B-Language
has	O
a	O
GLOB	B-Language
function	O
.	O
</s>
<s>
Tcl	B-Operating_System
contains	O
a	O
globbing	B-Language
facility	O
.	O
</s>
