Documentation » ksh93r docs » Manual pages » man3 » strmatch.3
en

strmatch.3


Introduction to Library Functions                     STRMATCH(3)

NAME
     strmatch - match shell file patterns

SYNOPSIS
     int strmatch(char* s, char* p)
     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 lead-
     ing 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.

                    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

     \ is used to escape *, ?, (, |, &, ), [, and  \  outside  of
     [...].

SEE ALSO
     grep(1)

BUGS
     An unbalanced ) terminates the top level pattern.
     Nested & and !  constructs are non-intuitive and are  compu-
     tationally intensive.

SunOS 5.10                Last change:                          1


Generated by GNU enscript 1.6.4.

Tags:
Created by admin on 2009/10/26 12:14
Last modified by admin on 2009/10/26 12:14

Collectives

Project ksh93-integration Pages


XWiki Enterprise 2.7.1.34853 - Documentation