user2559299
user2559299

Reputation: 83

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. 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.

Any ideas would be extremely helpful!

Upvotes: 3

Views: 7220

Answers (3)

Toto
Toto

Reputation: 91385

Use positive look ahead:

broker(?!.*broker).*suspicious

Upvotes: 1

anon
anon

Reputation:

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.

Upvotes: 3

wizebin
wizebin

Reputation: 730

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.

Upvotes: 1

Related Questions