MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / SimilarToRegex

Class SimilarToRegex

src/common/SimilarToRegex.h:40–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38};
39
40class SimilarToRegex : public PermanentStorage
41{
42public:
43 struct MatchPos
44 {
45 unsigned start;
46 unsigned length;
47 };
48
49public:
50 SimilarToRegex(MemoryPool& pool, unsigned flags,
51 const char* patternStr, unsigned patternLen, const char* escapeStr, unsigned escapeLen);
52 ~SimilarToRegex();
53
54public:
55 static bool isSpecialChar(ULONG c)
56 {
57 switch (c)
58 {
59 case '^':
60 case '-':
61 case '_':
62 case '%':
63 case '[':
64 case ']':
65 case '(':
66 case ')':
67 case '{':
68 case '}':
69 case '|':
70 case '?':
71 case '+':
72 case '*':
73 return true;
74 }
75
76 return false;
77 }
78
79private:
80 static void finalize(SimilarToRegex* self);
81
82public:
83 bool matches(const char* buffer, unsigned bufferLen, Array<MatchPos>* matchPosArray = nullptr);
84
85private:
86 MemoryPool::Finalizer* finalizer = nullptr;
87 AutoPtr<re2::RE2> regexp;
88};
89
90// Given a regular expression R1<escape>#R2#<escape>R3 and the string S:
91// - Find the shortest substring of S that matches R1 while the remainder (S23) matches R2R3;

Callers 6

setupSkipDataMethod · 0.85
setupIncludeDataMethod · 0.85
TracePluginImplMethod · 0.85
Re2SimilarMatcherMethod · 0.85
createPatternMatcherFunction · 0.85
TableMatcherMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected