| 95 | } |
| 96 | |
| 97 | int RegEx::Match(const char *const str, const size_t offset) |
| 98 | { |
| 99 | int rc = 0; |
| 100 | |
| 101 | if (mFree || re == nullptr) |
| 102 | return -1; |
| 103 | |
| 104 | this->ClearMatch(); |
| 105 | |
| 106 | //save str |
| 107 | subject = strdup(str); |
| 108 | |
| 109 | rc = pcre_exec(re, nullptr, subject, strlen(subject), offset, 0, mMatches[0].mVector, MAX_CAPTURES); |
| 110 | |
| 111 | if (rc < 0) |
| 112 | { |
| 113 | if (rc == PCRE_ERROR_NOMATCH) |
| 114 | { |
| 115 | return 0; |
| 116 | } else { |
| 117 | mErrorCode = rc; |
| 118 | return -1; |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | mMatches[0].mSubStringCount = rc; |
| 123 | mMatchCount = 1; |
| 124 | |
| 125 | return 1; |
| 126 | } |
| 127 | |
| 128 | int RegEx::MatchAll(const char *str) |
| 129 | { |
no test coverage detected