Jinoh Kang (@iamahuman) commented about programs/findstr/main.c:
- return (regexp[pos] == c && regexp[pos - 1] != '\');
+}
+static inline BOOL match_char(WCHAR c1, WCHAR c2, BOOL case_sensitive) +{
- if (case_sensitive) return c1 == c2;
- return towlower(c1) == towlower(c2);
+}
+static BOOL match_star(WCHAR, const WCHAR *, const WCHAR *, UINT, BOOL);
+static BOOL match_here(const WCHAR *str, const WCHAR *regexp, UINT pos, BOOL case_sensitive) +{
- if (regexp[pos] == '\' && regexp[pos + 1]) pos++;
- if (!regexp[pos]) return TRUE;
- if (is_op('*', regexp, pos + 1)) return match_star(regexp[pos], str, regexp, pos + 2, case_sensitive);
`match_star` doesn't account for escaped dot. `FINDSTR /R /C:".*"` will therefore match anything (works like `.*`), not just a sequence of dots (e.g., `....`).