xref: /titanic_44/usr/src/lib/libast/common/man/strmatch.3 (revision ee5416c9d7e449233197d5d20bc6b81e4ff091b2)
.fp 5 CW .. .nr ;G \\n(.f .Af "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9" \\*(;G .. .aF 5 \\n(.f "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" .. .aF 5 1 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" .. .aF 1 5 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" ..

0

..

..

STRMATCH 3
NAME
strmatch - match shell file patterns
SYNOPSIS
.L "int strmatch(char* s, char* p)"

.L "char* submatch(char* s, char* p, int m)"

DESCRIPTION
strmatch compares the string s with the shell pattern p and returns 1 for match and 0 otherwise. submatch does a leading substring match of the shell pattern p with the string s . If m is 0 then the match is minimal, otherwise a maximal match is done. A pointer to the first character after the matched substring is returned, 0 if there is no match.

Except for & and ! , each shell pattern has an equivalent egrep (1) construct. .EX sh pattern egrep RE description * .* 0 or more chars ? . any single char [.] [.] char class [!.] [^.] negated char class *(.) (.)* 0 or more of +(.) (.)+ 1 or more of ?(.) (.)? 0 or 1 of (.) (.) 1 of @(.) (.) 1 of a|b a|b a or b a&b a and b !(.) none of .L \e is used to escape *, ?, (, |, &, ), [, and \e outside of [...].

"SEE ALSO"
grep(1)
BUGS
An unbalanced .L ) terminates the top level pattern.

Nested .L & and .L ! constructs are non-intuitive and are computationally intensive.