MCPcopy Create free account
hub / github.com/alliedmodders/sourcemod / Match

Method Match

extensions/regex/CRegEx.cpp:97–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95}
96
97int 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
128int RegEx::MatchAll(const char *str)
129{

Callers 1

MatchRegexFunction · 0.80

Calls 1

ClearMatchMethod · 0.95

Tested by

no test coverage detected