0

How can I search with/without using regex to find all the files in a directory having two or three words , like I want to search apple and ornages I tried this :

in the Find what -> apple.*oranges

also using reg ex

in the Find what -> ^(apple  &  oranges) also ^(apple  &&  oranges)

but not able to find any though there are files containing both. OR rule also didnt work.

Here is an example on Notepad++ ,
tried both apple.*oranges as well as ^(apple  &&  oranges)

enter image description here

Raulp
  • 7,758
  • 20
  • 93
  • 155

1 Answers1

0

Are your match terms over multiple lines?

If so it doesn't look like Textpad supports multiline regular expression matches which would leave you with two options.

  1. Do a replace on all new line characters with a known string (e.g. [[NEWLINE]]) before the match, perform the match and then revert the replace
  2. Find another piece of software that supports multiline regular expression matches (Notepad++ does)

Edit - Regex to use is apples.*oranges

This matches the string apples followed by any character (optional) and then followed by oranges and checking the option for . to match a new line means that the search with work over multiple lines.

This will also match applesoranges as the * means 0 or more matches, you can change the * to a + if you need at least one character between the words.

rrrr-o
  • 2,447
  • 2
  • 24
  • 52
  • @Raulp I have added an edit with the regular expression to use, also make you you check the `. matches newline` option – rrrr-o Oct 07 '16 at 08:16