Brian Frost
Brian Frost

Reputation: 13454

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:

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

Upvotes: 3

Views: 1177

Answers (1)

Ken White
Ken White

Reputation: 125707

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 Search Dialog

GExperts Grep Results Dialog

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 Multi-file Grep Results Dialog

Upvotes: 6

Related Questions