简体   繁体   English

grep / regex搜索X但不搜索Y?

[英]grep/regex search for X but not Y?

BBEdit has an excellent "multi-file search" feature that can search with Grep. BBEdit具有出色的“多文件搜索”功能,可以使用Grep搜索。 I have some PHP code in need of cleaning up. 我有一些需要清理的PHP代码。 For example, I'd like to find all instances of ... 例如,我想查找...的所有实例。

FROM table

... but not ... ... 但不是 ...

FROM `table`

In other words, I want find "FROM xyz" where the first character of xyz is NOT the carat symbol. 换句话说,我想找到“ FROM xyz”,其中xyz的第一个字符不是克拉符号。

Is this doable? 这可行吗?

试试这个正则表达式:

/FROM \b\w+\b/

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

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