Copilot commented on code in PR #13517:
URL: https://github.com/apache/trafficserver/pull/13517#discussion_r3738318086
##########
include/tsutil/Regex.h:
##########
@@ -68,7 +68,12 @@ class RegexMatches
/** Get the match at the given index.
*
- * @return The match at the given index.
+ * An index the match did not populate, and a group that did not participate
in the match, both
+ * yield an empty view. The result never has a null data(), so it can be
handed straight to
+ * memcpy(), std::string::append() and "%.*s". Use get_ovector_pointer() to
tell a group that did
+ * not participate from one that matched an empty string.
Review Comment:
The doc suggests using get_ovector_pointer() to distinguish a
non-participating group from an empty-string match, but that only works for
indices the match actually populated (index < size()). For index >= size(), the
ovector entry is undefined, so callers should use size() as the primary bound
and only consult PCRE2_UNSET within that bound.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]