summaryrefslogtreecommitdiffstats
path: root/wsutil/regex.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--wsutil/regex.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/wsutil/regex.h b/wsutil/regex.h
index 0484eab3..199779a2 100644
--- a/wsutil/regex.h
+++ b/wsutil/regex.h
@@ -26,6 +26,7 @@ ws_regex_compile(const char *patt, char **errmsg);
/* By default UTF-8 is off. This option also prevents it from being
* turned on using a pattern option. */
#define WS_REGEX_NEVER_UTF (1U << 1)
+#define WS_REGEX_ANCHORED (1U << 2)
WS_DLL_PUBLIC ws_regex_t *
ws_regex_compile_ex(const char *patt, ssize_t size, char **errmsg, unsigned flags);
@@ -41,14 +42,19 @@ ws_regex_matches_length(const ws_regex_t *re,
/** Returns start and end position of the matched substring.
*
+ * @note Using a nonzero subj_offset produces different results than
+ * passing a pointer to the later offset as subj when the pattern
+ * begins with a lookbehind.
+ *
* pos_vect[0] is first codepoint in the matched substring.
- * pos_vect[1] is the next to last codepoint in the matched substring.
+ * pos_vect[1] is first codepoint past the matched substring.
* pos_vect[1] - pos_vect[0] is the matched substring length.
+ *
*/
WS_DLL_PUBLIC bool
ws_regex_matches_pos(const ws_regex_t *re,
const char *subj, ssize_t subj_length,
- size_t pos_vect[2]);
+ size_t subj_offset, size_t pos_vect[2]);
WS_DLL_PUBLIC void
ws_regex_free(ws_regex_t *re);