Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Notepad++ RegEx: Search for multiple words in a huge text file

I have a text file with about 4000 lines of text in it. I need to search for the words "there" and "when". Ive tried a few regex type of things but they all do it wrong or dont get detected at all. So how would I search for those 2 words and it would show ALL the matches for both words?

Thanks in advance!

like image 214
hennessy Avatar asked Feb 06 '13 11:02

hennessy


People also ask

Can I use RegEx in Notepad?

Using Regex to find and replace text in Notepad++ In all examples, use select Find and Replace (Ctrl + H) to replace all the matches with the desired string or (no string). And also ensure the 'Regular expression' radio button is set.

How do you search for an exact phrase in notepad?

1.3, doing any of those keystrokes ( Ctrl+F , Ctrl+H , Ctrl+Shift+F , or Ctrl+M ) once would open the Find dialog or bring it into focus; from the main dialog, hitting Ctrl+F would re-center the dialog (no matter which tab of the dialog you were on); but you could not use the shortcuts for the other tabs to switch ...

What RegEx does Notepad++ use?

FYI Notepad++ supports “PCRE” (i.e. PERL Compatible Regular Expressions) using Boost's RegEx library which is different from the PCRE and PCRE2 libraries.


1 Answers

Use this regex

(there|when)

and make sure you enabled the "regular expression" radio button.

You can also use

there|when

if you don't need to use references for search&replace.

like image 131
Adam Adamaszek Avatar answered Sep 24 '22 01:09

Adam Adamaszek