-
Notifications
You must be signed in to change notification settings - Fork 1
/
wildmat.3
89 lines (89 loc) · 2.14 KB
/
wildmat.3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
.\" $Revision: 1.10 $
.TH WILDMAT 3
.SH NAME
wildmat \- perform shell-style wildcard matching
.SH SYNOPSIS
.nf
.B "int"
.B "wildmat(text, pattern)"
.B " char *text;"
.B " char *pattern;"
.fi
.SH DESCRIPTION
.I Wildmat
compares the
.I text
against the
.I pattern
and
returns non-zero if the pattern matches the text.
The pattern is interpreted according to rules similar to shell filename
wildcards, and not as a full regular expression such as those handled by the
.IR grep (1)
family of programs or the
.IR regex (3)
or
.IR regexp (3)
set of routines.
.PP
The pattern is interpreted as follows:
.TP
.BI \e x
Turns off the special meaning of
.I x
and matches it directly; this is used mostly before a question mark or
asterisk, and is not special inside square brackets.
.TP
.B ?
Matches any single character.
.TP
.B *
Matches any sequence of zero or more characters.
.TP
.BI [ x...y ]
Matches any single character specified by the set
.IR x...y .
A minus sign may be used to indicate a range of characters.
That is,
.I [0\-5abc]
is a shorthand for
.IR [012345abc] .
More than one range may appear inside a character set;
.I [0-9a-zA-Z._]
matches almost all of the legal characters for a host name.
The close bracket,
.IR ] ,
may be used if it is the first character in the set.
The minus sign,
.IR \- ,
may be used if it is either the first or last character in the set.
.TP
.BI [^ x...y ]
This matches any character
.I not
in the set
.IR x...y ,
which is interpreted as described above.
For example,
.I [^]\-]
matches any character other than a close bracket or minus sign.
.SH HISTORY
Written by Rich $alz <[email protected]> in 1986, and posted to Usenet
several times since then, most notably in comp.sources.misc in
March, 1991.
.PP
Lars Mathiesen <[email protected]> enhanced the multi-asterisk failure
mode in early 1991.
.PP
Rich and Lars increased the efficiency of star patterns and reposted it
to comp.sources.misc in April, 1991.
.PP
Robert Elz <[email protected]> added minus sign and close bracket handling
in June, 1991.
.PP
.de R$
This is revision \\$3, dated \\$4.
..
.R$ $Id: wildmat.3,v 1.10 1992/04/03 06:30:05 rsalz Exp $
.SH "SEE ALSO"
grep(1), regex(3), regexp(3).