derekas4
derekas4

Reputation: 15

How to search between multiple lines in Notepad

how to perform a search between multiple lines and delete selected text, let's the example I want to start a search from the word "SHARE THIS: " to < h4> select all text and delete it. When i search in 1 line i use .*?.*

                SHARE THIS: 
                Good game and key. very good mate
                Thanks for help! works
                is a good game on the world.
                <h4>
                rates

Upvotes: 0

Views: 1399

Answers (2)

Toto
Toto

Reputation: 91518

  • Ctrl+H
  • Find what: \bSHARE THIS:.+?<h4>\R?
  • Replace with: LEAVE EMPTY
  • CHECK Wrap around
  • CHECK Regular expression
  • CHECK . matches newline
  • Replace all

Explanation:

\b              # word boundary
SHARE THIS:     # literally
.+?             # 1 or more any character, not greedy
<h4>            # literally
\R?             # any kind of linebreak, optional

Screen capture (before):

enter image description here

Screen capture (after):

enter image description here

Upvotes: 2

laserany
laserany

Reputation: 1451

a picture worth 1000 words. make sure you checkmark .matches newlines and choose regular expression.

enter image description here

Upvotes: 1

Related Questions