regex_t *regex,
int *result_begin,
int *result_end)
+{
+ regmatch_t match;
+ return text_search_match(
+ text,
+ search,
+ pos,
+ backwards,
+ case_sensitive,
+ regex,
+ result_begin,
+ result_end,
+ &match, 1);
+}
+
+int text_search_match(
+ cxstring text,
+ cxstring search,
+ int pos,
+ bool backwards,
+ bool case_sensitive,
+ regex_t *regex,
+ int *result_begin,
+ int *result_end,
+ regmatch_t *match,
+ size_t nmatch)
{
cxstring result = (cxstring){NULL,0};
if(!backwards) {
}
} else {
// case_sensitive parameter is ignored in regex mode
- regmatch_t match;
- if(regexec(regex, subtext.ptr, 1, &match, 0) != 0) {
+ if(regexec(regex, subtext.ptr, nmatch, match, 0) != 0) {
return 0;
}
- *result_begin = match.rm_so + pos;
- *result_end = match.rm_eo + pos;
+ *result_begin = match->rm_so + pos;
+ *result_end = match->rm_eo + pos;
return 1;
}
} else {
int *result_begin,
int *result_end);
+int text_search_match(
+ cxstring text,
+ cxstring search,
+ int pos,
+ bool backwards,
+ bool case_sensitive,
+ regex_t *regex,
+ int *result_begin,
+ int *result_end,
+ regmatch_t *match,
+ size_t nmatch);
+
+
void note_search_next(NoteModel *note);
void note_search_prev(NoteModel *note);
void note_replace(NoteModel *note);