Re: [PATCH] Allow preg_split to capture offsets
| From: | Andrei Zmievski | Date: | Thu, 23 May 2002 17:28:02 +0000 |
| Subject: | Re: [PATCH] Allow preg_split to capture offsets | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-84319@lists.php.net to get a copy of this message | ||
David,
> Enclosed is a patch to allow PCRE's preg_split to return an array of
> (match, offset) pairs, if PREG_SPLIT_OFFSET_CAPTURE is or'd into the
> flags parameter. Submitted for inclusion, rejection, extensive flaming,
> or suggestions. :)
I've applied the patch with some modifications. Notably, when
PREG_SPLIT_DELIM_CAPTURE was along with this new flag, the delimiters
were not being captured with offsets. I also abstracted the match pair
addition into a separate (inlined) function.
-Andrei http://www.gravitonic.com/