[PHP-DEV] CVS update: php3/functions From: andrey (php-dev <email protected>)
Date: 05/29/99

Date: Saturday May 29, 1999 @ 17:28
Author: andrey

Update of /repository/php3/functions
In directory php:/tmp/cvs-serv19334/functions

Modified Files:
        pcre.c
Log Message:
-Updated docs a little bit
-preg_match_all() now returns the number of global matches

Index: php3/functions/pcre.c
diff -u php3/functions/pcre.c:1.5 php3/functions/pcre.c:1.6
--- php3/functions/pcre.c:1.5 Sat May 29 17:05:26 1999
+++ php3/functions/pcre.c Sat May 29 17:28:56 1999
@@ -27,7 +27,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: pcre.c,v 1.5 1999/05/29 21:05:26 andrey Exp $ */
+/* $Id: pcre.c,v 1.6 1999/05/29 21:28:56 andrey Exp $ */
 
 #include "php.h"
 
@@ -345,6 +345,7 @@
         piece = subject->value.str.val;
         subject_end = piece + subject->value.str.len;
         match = NULL;
+ matched = 0;
         
         do {
                 /* Execute the regular expression. */
@@ -361,7 +362,7 @@
 
                 /* If something has matched */
                 if (count >= 0) {
- matched = 1;
+ matched++;
                         match = piece + offsets[0];
 
                         /* If subpatters array has been passed, fill it in with values. */
@@ -406,10 +407,6 @@
                                 /* Advance to the position right after the last full match */
                                 piece += offsets[1];
                         }
- }
- /* If nothing matched */
- else {
- matched = 0;
                 }
         } while (global && count >= 0);
 

--
PHP Development Mailing List   http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe <email protected>
For help: php-dev-help <email protected>