Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I perform a boolean 'AND' search in Delphi using 'Find in Files?

Now that my code is getting ever larger, a strategy to locate key code locations is more important. With faster PC's now, 'Search' 'Find in Files' is quick and effective - 'Search all files in project' often does not work if you have used implicit units. I've struggled to understand regular expressions but presumably they would let me do a search like:

one OR two

one AND two

All searches are required to be on the same line.

This would be a great improvement on a simple keyword search. Is this possible in Delphi's search? I'm using XE, XE2 and D7 (sometimes).

like image 964
Brian Frost Avatar asked Oct 28 '11 08:10

Brian Frost


1 Answers

The regular expression you need to search for one or two is

one|two

The | symbol means or in regex speak.

Searching for a file containing both one and two is more difficult since the search is line-oriented. You could search for one and two on the same line like this:

one.*two|two.*one
like image 157
David Heffernan Avatar answered Nov 15 '22 05:11

David Heffernan