简体   繁体   English

Notepad ++上的正则表达式两个单词在同一行

[英]Regular Expressions on Notepad++ two words on the same line

I am trying to use Regular Expressions in notepad++ to find two words that are on the same line of each other. 我试图在notepad ++中使用正则表达式来查找彼此同一行的两个单词。 For example I want to find this line by searching for broker and suspicious: 例如,我想通过搜索代理和可疑来查找此行:

If a securities broker believes that a client might be engaging in transactions to launder money, the broker is required to file a Suspicious Activity Report. 如果证券经纪人认为客户可能从事交易以洗钱,则要求经纪人提交可疑活动报告。

I tried using broker.*suspicious but this would highlight the first instant of broker, all the way to the first instance of the word suspicious. 我尝试使用broker。* suspicious,但这会突出显示broker的第一个瞬间,一直到可疑一词的第一个实例。

Any ideas would be extremely helpful! 任何想法都将非常有帮助!

Use positive look ahead : 使用正面的展望

broker(?!.*broker).*suspicious 经纪人(?!。*经纪人)。*可疑

I'm not positive this is what you're looking for, but you can do something like this: 我不太确定这是您要寻找的,但是您可以执行以下操作:

broker[^\\r\\n]+suspicious

To find every instance of broker...suspicious that isn't separated by a newline. 要查找没有用换行符分隔的代理的每个实例...可疑。

In Notepad++, there should be a checkbox that says something like " . matches newline". 在记事本++,应该有一个复选框说像“匹配换行”。 . Uncheck that and . 取消选中和. will no longer match newlines, so it'll fail if it can't find "suspicious" on the same line. 将不再匹配换行符,因此,如果在同一行中找不到“可疑”,它将失败。

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

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