- else if (r == PCRE_ERROR_NOMATCH) {
- /* No match at all, so we can dump the input buffer. */
- clear_buffer (h);
+ for (i = 0; regexps[i].r > 0; ++i) {
+ int options = regexps[i].options | PCRE_PARTIAL_SOFT;
+
+ r = pcre_exec (regexps[i].re, regexps[i].extra,
+ h->buffer, (int)h->len, 0,
+ options,
+ ovector, ovecsize);
+ h->pcre_error = r;
+
+ if (r >= 0) {
+ /* A full match. */
+ if (ovector != NULL && ovecsize >= 1 && ovector[1] >= 0)
+ h->next_match = ovector[1];
+ else
+ h->next_match = -1;
+ return regexps[i].r;
+ }
+
+ else if (r == PCRE_ERROR_NOMATCH) {
+ /* No match at all. */
+ /* (nothing here) */
+ }
+
+ else if (r == PCRE_ERROR_PARTIAL) {
+ /* Partial match. Keep the buffer and keep reading. */
+ can_clear_buffer = 0;
+ }
+
+ else {
+ /* An actual PCRE error. */
+ return MEXP_PCRE_ERROR;
+ }