3

如何使用 GExperts grep 搜索在 Delphi 源代码中找到包含字符串文字而不是资源字符串的所有行,除了那些标记为的行'do not translate'

例子:

这一行应该匹配

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

此行不应匹配

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

(专门询问 GExpert,因为它的 grep 实现有限)

4

1 回答 1

2

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

于 2011-03-07T14:21:43.297 回答