user4382574
user4382574

Reputation:

regex two words search in Notepad++

I want to in below sample text using regex find:

I have tried searching for:

Loves*."$

And replace with /1 Very Much but no luck, pointers are appreciated.

I am using Notepad++ for this.

"Sample Text"
--------------------

    DOLLY Loves DOLLS" Like Elephant"
    DOLLY;
    DOLLY Loves DOLLS Like Dog"
    DOLLY Loves DOLLS Like Cat" But Bats Not
    DOLLY "Loves" Her Lover Matt"
    Mr. O' Neil" King Hates Dolls
    DOLLY Loves DOLLS Like Bat"
    DOLLY;

Upvotes: 1

Views: 755

Answers (2)

hwnd
hwnd

Reputation: 70732

You can use the following regular expression in Notepad++.

Find: \b(Loves.*")$
Replace: \1 Very Much

Note: Make sure "Regular expression" is checked and . matches newline is unchecked.

Upvotes: 1

elixenide
elixenide

Reputation: 44833

This is untested but should work. Make sure case-insensitive matching is on. Search:

(Loves.*")$

Replace

$1 Very Much

Also, make sure you're doing a global replace (Replace All). Otherwise, it will only match the first instance after the cursor. See this Regex101 demo

Upvotes: 0

Related Questions