Exemple #1
0
int pmatch(const char *Pattern, const char *String, int Len, ListNode *Matches, int Flags)
{
    const char **Compiled=NULL;
    const char *s_ptr, *s_end;
    int result=0;

    pmatch_compile(Pattern,&Compiled);

    //We handle PMATCH_SUBSTR in this function
    s_end=String+Len;

    if (Flags & PMATCH_SUBSTR)
    {
        for (s_ptr=String; s_ptr < s_end; s_ptr++)
        {
            result+=pmatch_process((const char **) Compiled, s_ptr, s_end-s_ptr, Matches, Flags);
            Flags |= PMATCH_NOTSTART;
        }
    }
    else result=pmatch_process((const char **) Compiled, String, Len, Matches, Flags);

    /*
    				//if we allow matches to overlap, then we'll check for a match
    				//at every position, otherwise we jump to end of this match
    				if (! (Flags & PMATCH_OVERLAP))
    				{
    					s_ptr=End;
    					s_ptr--;
    				}
    */

    if (Compiled) free(Compiled);
    return(result);
}
Exemple #2
0
int pmatch(char *Pattern, char *String, int Len, ListNode *Matches, int Flags)
{
char *ptr, **Compiled=NULL;
int result, len;

	pmatch_compile(Pattern,&Compiled);

	ptr=String;	
	len=Len;

	result=pmatch_process(Compiled, ptr, len, Matches, Flags);

	if (Compiled) free(Compiled);
	return(result);
}
Exemple #3
0
int pmatch(char *Pattern, char *String, char **Start, char **End, int Flags)
{
    char *ptr;

    //deal with the easy situation first
    if (StrLen(Pattern)==0)
    {
        if (StrLen(String)==0) return(TRUE);
        else return(FALSE);
    }

    ptr=Pattern;
    while (ptr)
    {
        if (pmatch_process(ptr, String, Start, End, Flags)) return(TRUE);
        ptr=strchr(ptr+1,'|');
        if (ptr) ptr++;
    }

    return(FALSE);
}