[(;]\s*(\w*)\s*:\s\w*[sS]tring\W
This expression locates most candidates for a missing const modifier for string types.
[(;]\s*(\w*)\s*:\s*([I]\w*|\w*[sS]tring)\W
Same as above, also includes type names beginning with the letter I (coding convention for interface types).
Examples
// no match procedure Test(const Arg: string); // match procedure Test(Arg: WideString); // no match procedure Test(const Arg: string; var Arg2: WideString); // match procedure Test(const Arg: string; Arg2: AnsiString);
Tested with GExperts Grep Search, which does not support multiline expressions.
Usage example with GExperts Grep Search
Discover more from Habarisoft Blog
Subscribe to get the latest posts sent to your email.