--- In [email protected], "entropyreduction" <alancampbelllists+ya...@...> wrote: > > --- In [email protected], "Sheri" <sherip99@> wrote: > > > But another problem. Appears that for "ends" option, the > endoffset reported is zero-based, whereas for "starts" option, > the startoffset is one-based. > > Hmm. Don't think so, unless I changed something I forgot in > > regexPlugin209_091030.zip > (http://tech.groups.yahoo.com/group/power-pro/files/0_TEMP_/AlansPluginProvisional/) > > Run script in zip. > > > regex.pcrematch(?"ab.*e", "cdeabcde", "start length end", hVec) > > returns > > abcde starts at: 4 ends at 8 length: 5 > > which look like the right start and end positions to me. > > What you may be referring to is what pcre returns in _its_ vector > > "The first element of each pair is set to the byte offset of the > first character in a substring, and the second is set to the byte > offset of the first character after the end of a substring" > > "first character after the end of a substring" makes no sense > inside powerpro: if match went to end of string, you'd get back a > position beyound the end of string (which would be to the null > terminator in C).
> BTW added > > start length end > > for > > starts lengths ends > In all cases the plugin is making the start offset one greater than PCRE's startoffset and the endoffset equal to PCRE's endoffset, with the circumstance that for an empty match, the plugin's endoffset is less than the startoffset. Testing the pattern "^" gets a plugin start of one and an end of zero. Nonetheless, the existing combination is useful for retrieving strings from the subject using powerpro's Select function, as neither start nor end needs adjusting for that that purpose. I guess what we currently have is start and end character, as opposed to start and end offsets. An offset is a position before or after a character. > Could add a set_base service, so offsets returned were zero-based > or one-based. No thanks. If anything I would want p_start and p_end, but I think it would be easy enough to subtract one from the number currently returned as start, and use the end as-is. Regards, Sheri
