简体   繁体   English

如何在Delphi中使用“文件查找”执行布尔“ AND”搜索?

[英]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. 现在有了较快的PC,“搜索”“查找文件”是快速有效的-如果使用隐式单位,“搜索项目中的所有文件”通常不起作用。 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? 在Delphi的搜索中有可能吗? I'm using XE, XE2 and D7 (sometimes). 我正在使用XE,XE2和D7(有时)。

The regular expression you need to search for one or two is 您需要搜索one two的正则表达式是

one|two

The | | symbol means or in regex speak. 符号表示or用正则表达式表示。

Searching for a file containing both one and two is more difficult since the search is line-oriented. 搜索包含onetwo文件的文件更加困难,因为搜索是面向行的。 You could search for one and two on the same line like this: 您可以像这样在同一行上搜索onetwo

one.*two|two.*one

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 查找/保存:如何递归搜索/替换文件中的字符串,但仅查找与特定正则表达式匹配的行 - Find/sed: How can I recursively search/replace a string in files but only for lines that match a particular regexp 我可以对 Redis 值执行正则表达式搜索吗? - Can I perform a regex search on Redis values? 如何搜索目录并找到与正则表达式匹配的文件? - How do i search directories and find files that match regex? 如何在angularjs中使用正则表达式执行否定搜索 - How to perform a negative search using regex in angularjs 如何使用 php 正则表达式执行多重搜索? - How to perform multiple search using php regex? 如何使用 map 和 match 执行我的部分代码? - How can I perform my part of code using map and match? 如何执行不区分大小写的模式搜索和保留大小写的替换? - How can I perform case-insensitive pattern search and case-preserving replacement? 如何在巨大的 json 文件之间执行最优模式搜索? - How to perform optimal pattern search between huge json files? 如何对给定后缀的文件执行不区分大小写的搜索? - How to perform a case-insensitive search for files of a given suffix? 如何使用正则表达式实现搜索? - How can I implement a search using regex?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM