How to search between multiple lines in Notepad++ ??
-
Hello, Everyone
I am trying to perform a search between multiple lines and also delete selected text.
Example show below :-I want to start a search from this word “Description This:” To “<h3>” select all text and delete it.
When i search in 1st line i have used.*?.*Description This: Hello everyone. How are you ? Where are you ? I am going to School please come with me. Thank you for everything. <h3> Good to see you.Thank you in advance.
-
Hello, Prahlad-Makwana4145 and All,
Hi, Happy New Year 2020 !
Regarding your problem, two solutions are possible :
- SEARCH
(?-i)^Description(?s).*?<h3>\R
OR
-
SEARCH
(?-i)^Description(.|\R)*?<h3>\R -
REPLACE
Leave EMPTY -
Tick the
Wrap aroundoption and select theRegular expressionsearch mode -
Use either the
Replace Allor theReplacebutton
Notes :
-
First, the in-line modifier
(?-i)forces the search to care about casing of letters -
After the part
^Descriptionlooks for the wordDescription, with that exact case, at beginning of lines -
Then the part
(?s), an in-line modifier too, means that any subsequent regex.symbol will match any single character, including EOL ones -
Now, the part
.*?represents the shortest range of any character till… -
The part
<h3>\Rwhich matches an<h3>tag with its ine-break (\R) -
As replacement is empty, any text matched is just deleted
-
In the second search form, we replace the part
(?s).with(.|\R)which stands, in the same way, for a single standard or an EOL character
Best Regards,
guy038
- SEARCH
-
Hello, Happy New Year 2020 ! @guy038 and All,
Thank you for Replay your both solution are work successfully for me.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login