26inline auto wildcardMatch(
const char *text,
const char *pattern) ->
bool {
27 while (*pattern !=
'\0') {
32 const char *p = pattern;
34 const char *q = p + 1;
35 bool isRecur = (q[0] ==
'*' && q[1] ==
'*') ||
36 (q[0] ==
'.' && q[1] ==
'.' && q[2] ==
'.');
44 if (p[0] ==
'*' && p[1] ==
'*') {
46 }
else if (p[0] ==
'.' && p[1] ==
'.' && p[2] ==
'.') {
51 const char *afterRecur = p + recurLen;
52 bool hasTrail = (*afterRecur ==
'.');
53 const char *rest = hasTrail ? afterRecur + 1 : afterRecur;
55 if (hasLead && hasTrail) {
65 while (*text !=
'\0') {
101 while (*text !=
'\0') {
122 if (*pattern ==
'*') {
124 const char *rest = pattern + 1;
129 if (*text ==
'\0' || *text ==
'.') {
136 if (*pattern ==
'?') {
138 if (*text ==
'\0' || *text ==
'.') {
146 if (*pattern != *text) {
152 return *text ==
'\0';
Definition Utilities.hpp:16
auto wildcardMatch(const char *text, const char *pattern) -> bool
Definition Wildcard.hpp:26