开发者

GExperts grep expression for source lines with string literals (for translation)

开发者 https://www.devze.com 2023-02-15 19:19 出处:网络
How can I find all lines in Delphi source code using GExperts grep search which contain a string literal instead of a resource string, except those lines which are marked as \'d开发者_C百科o not trans

How can I find all lines in Delphi source code using GExperts grep search which contain a string literal instead of a resource string, except those lines which are marked as 'd开发者_C百科o not translate'?

Example:

this line should match

  ShowMessage('Fatal error! Save all data and restart the application');

this line should not match

  FieldByName('End Date').Clear; // do not translate

(Asking specifically about GExpert as it has a limited grep implementation afaik)


Regular Expressions cannot be negated in general.

Since you want to negate a portion of the search, this comes as close as I could get it within the RegEx boundaries that GExpers Grep Search understands:

\'.*\'.*[^n][^o][^t][^ ][^t][^r][^a][^n][^s][^l][^a][^t][^e]$

Edit: Forgot the end-of-line $ marker, as GExperts Grep Search cannot do without.

blokhead explains why you cannot negate in general.

This Visual Studio Quick Search uses the tilde for negation, but the GExperts Grep Search cannot.

The grep command-line search has the -v (reverse) option to negate a complete search (but not a partial search).

A perfect manual negation gets complicated very rapidly.

--jeroen

0

精彩评论

暂无评论...
验证码 换一张
取 消