Re: [PATCH] Allow preg_split to capture offsets
| From: | David Brown | Date: | Thu, 23 May 2002 16:36:25 +0000 |
| Subject: | Re: [PATCH] Allow preg_split to capture offsets | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-84323@lists.php.net to get a copy of this message | ||
On Thu, May 23, 2002 at 12:28:02PM -0500, Andrei Zmievski wrote:
> 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.
Both of those were on my to do list, but I figured I'd go ahead and post
my 10-minute hack to gauge interest before moving forward.
Anyway, much thanks. :)
- Dave
dave@codewhore.org