Function re_matchp

Synopsis

#include <re.h>

int re_matchp(re_t pattern, const char *text, int *matchlength)

Description

No description yet.

Mentioned in

Source

Lines 78-107 in re.c. Line 54 in re.h.

int re_matchp(re_t pattern, const char* text, int* matchlength)
{
  *matchlength = 0;
  if (pattern != 0)
  {
    if (pattern[0].type == BEGIN)
    {
      return ((matchpattern(&pattern[1], text, matchlength)) ? 0 : -1);
    }
    else
    {
      int idx = -1;

      do
      {
        idx += 1;

        if (matchpattern(pattern, text, matchlength))
        {
          if (text[0] == '\0')
            return -1;

          return idx;
        }
      }
      while (*text++ != '\0');
    }
  }
  return -1;
}





Add Discussion as Guest

Log in