[pcre-dev] [Bug 682] Add REG_STARTEND support to PCRE

Αρχική Σελίδα
Delete this message
Συντάκτης: Philip Hazel
Ημερομηνία:  
Προς: pcre-dev
Αντικείμενο: [pcre-dev] [Bug 682] Add REG_STARTEND support to PCRE
------- You are receiving this mail because: -------
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=682




--- Comment #1 from Philip Hazel <ph10@???> 2008-03-20 16:42:15 ---
On Thu, 20 Mar 2008, Alan Lehotsky wrote:

> BSD has the ability to do matching with a string that is not zero-terminated.
> It does this by adding a flag REG_STARTEND and passing in values in
> the match[0] vector when calling the regexec() function.


> It's a trivial addition to PCRE to support this.


I don't understand the need for another interface, because pcre_exec()
already takes its string as an address and a length. It is NOT zero-
terminated. (The regex passed to pcre_compile() is zero-terminated,
however.)

> Here's a patch against the 7.5 sources. If the REG_STARTEND flag is
> set when calling pcre_exec(), the string start and end positions are
> selected from the pmatch[0].rm_so and .rm_eo members instead of
> assuming 0 and strlen(string).
>
> ed pcreposix.h <<EOF

     ^^^^^^^^^


AHA! OK, now I *do* understand - you are are talking about the POSIX
interface. (I should have guessed from your mention of REG_xxx and
regexec().) I tend to forget about the POSIX interface, because it
really is there only for compatibility with old software that already
uses the POSIX calls. I advise that new programs should use the more
featureful native PCRE interface.

Thanks for the patch. It seems reasonable and I will put it on at some
point.

Regards,
Philip


--
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email