/[pcre]/code/tags/pcre-3.5/pcretest.c
ViewVC logotype

Diff of /code/tags/pcre-3.5/pcretest.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 46 by nigel, Sat Feb 24 21:39:25 2007 UTC revision 47 by nigel, Sat Feb 24 21:39:29 2007 UTC
# Line 995  while (!done) Line 995  while (!done)
995          }          }
996    
997        /* Failed to match. If this is a /g or /G loop and we previously set        /* Failed to match. If this is a /g or /G loop and we previously set
998        PCRE_NOTEMPTY after a null match, this is not necessarily the end.        g_notempty after a null match, this is not necessarily the end.
999        We want to advance the start offset, and continue. Fudge the offset        We want to advance the start offset, and continue. Fudge the offset
1000        values to achieve this. We won't be at the end of the string - that        values to achieve this. We won't be at the end of the string - that
1001        was checked before setting PCRE_NOTEMPTY. */        was checked before setting g_notempty. */
1002    
1003        else        else
1004          {          {
# Line 1025  while (!done) Line 1025  while (!done)
1025        /* If we have matched an empty string, first check to see if we are at        /* If we have matched an empty string, first check to see if we are at
1026        the end of the subject. If so, the /g loop is over. Otherwise, mimic        the end of the subject. If so, the /g loop is over. Otherwise, mimic
1027        what Perl's /g options does. This turns out to be rather cunning. First        what Perl's /g options does. This turns out to be rather cunning. First
1028        we set PCRE_NOTEMPTY and try the match again at the same point. If this        we set PCRE_NOTEMPTY and PCRE_ANCHORED and try the match again at the
1029        fails (picked up above) we advance to the next character. */        same point. If this fails (picked up above) we advance to the next
1030          character. */
1031    
1032        g_notempty = 0;        g_notempty = 0;
1033        if (offsets[0] == offsets[1])        if (offsets[0] == offsets[1])
1034          {          {
1035          if (offsets[0] == len) break;          if (offsets[0] == len) break;
1036          g_notempty = PCRE_NOTEMPTY;          g_notempty = PCRE_NOTEMPTY | PCRE_ANCHORED;
1037          }          }
1038    
1039        /* For /g, update the start offset, leaving the rest alone */        /* For /g, update the start offset, leaving the rest alone */

Legend:
Removed from v.46  
changed lines
  Added in v.47

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12