简体   繁体   中英

How can I search for <item1> AND <item2> using the Delphi XE2 IDE search?

I use searching all the time to locate stuff within my (huge) application source, so search effectiveness is very important to me. Presently in the Delphi XE2 IDE I like to use:

  • Find in Files
  • Include subdirectories.

Nothing else fancy, just a text keyword. This works ok but what I would really like to do is to extend what I'm doing now to include lines that contain 'A' AND 'B' where A and B are any group of characters (one type of boolean search). Exact matches against A and B are fine, because this now allows you to put in two very partial keywords and still find a unique occurence. I've been using this method in my own search engine for years. Is there an easy way of doing this in the Delphi IDE please? Thanks

You can use regular expressions (just check the regular expressions checkbox on the right side of the Find window). The regex support is somewhat limited - it's documented for XE2 on the XE2 docwiki here .

I use GExperts Grep Search instead (part of the GExperts IDE experts set), which offers fuller regex support (although still not great) and a better display (IMO) of the search results. (Note the image of the Grep Search dialog contains a regular expression that will match WordA or WordB in either order in the file, so it satisfies your search logic within the limited regex support in GExperts. It matches single words on the line as well, but the results dialog makes it easy to find the lines you're interested in, and double-clicking a line will take you to that match in the IDE's code editor.)

GExperts Grep搜索对话框

GExperts Grep结果对话框

The above results are based on a single file search and those results. For multiple files (in this case, just two), the dialog appears like this:

GExperts多文件Grep结果对话框

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM