   dim F$(20),W$(20)

Def MatchWildCardTo(WildCard$,MatchToString$)
    ! Function to match WildCard containing "*" to MatchToString
    ! Returns TRUE or FALSE based on match result

    i=find(WildCard$,"*")
    if i=0 then return MatchToString$=WildCard$ \ ! Wildcard has form: <text>

    ! WildCard$ has form: <text>*<moretext>
    if find(MatchToString$,WildCard$(1,i-1))<>1
    then return false \ ! Prefixes don't match
    MatchToPointer=i \ ! skip past matched prefix
    WildCardPointer=1 \ ! Set up for For loop in Repeat, below
    Repeat
        ! i holds offset from WildCardPointer to next "*" in WildCard$
        ! starting after * search for first non *
        for WildCardPointer=WildCardPointer+i to len(WildCard$) ...
&           Until WildCard$(WildCardPointer,1)<>"*" ...
&           do ! Skip past matched text and possible multiple "*"s

        ! Now match something to the "*" skipped in the WildCard$
        if WildCardPointer>Len(WildCard$) then return true \ ! Matched !
        if MatchToPointer>Len(MatchToString$) then return false
        ! At this point, WildCard$ has form: <matchedtext>*<text>...
        i=find(Right$(WildCard$,WildCardPointer),"*")
        if i=0
        then
            ! Wildcard has form:  *<text>
            i=Len(WildCard$)-WildCardPointer+1 \ ! Amount to match
            if Len(MatchToString$)-MatchToPointer+1 < i
            then return false \ ! Tail of MatchToString$ is too short
            ! Tail is long enough, see if matches wildcard tail
            return MatchToString$[Len(MatchToString$)-i+1,i]=...
&                  Right$(WildCard$,WildCardPointer)
        fi
        ! i points to * after text
        ! WildCard$ has form: *<text>*<moretext>


        i1=find(Right$(MatchToString$,MatchToPointer),...
&               WildCard$[WildCardPointer,i-1])

        print Right$(MatchToString$,MatchToPointer)
        print  WildCard$[WildCardPointer,i-1]
        print "MatchToPointer";Matchtopointer
        print "i1";i1
        print "i";i
        print "wildcardpointer";wildcardpointer


        if i1=0 then return false \ ! Can't find text in MatchToString$

        ! MatchToPointer= MatchToPointer + where found (disp 0) + how long
        Let MatchToPointer= MatchToPointer + (i1-1) + (i-1)

    end
end

100
   input "Wildcard String " W$
110
   input "Filename String " F$
   if F$="" then goto 100
   if MatchWildCardTo(W$,F$) Then Print "True" Else Print "False"
   goto 110




end




