DIGIT-ARC read-only archive · snapshot: July 23, 2026

Notepad++ regex help

8 posts · originally from https://geek.digit.in/community/threads/notepad-regex-help.154742/

braindead
braindead Original post #1
Mar 27, 2012 at 10:00 PM
eg: i would like to replace the following text

.....blah blah....
Work Phone 2:
Home Phone 1:
Home Phone 2:
Mobile:
Pager:
Fax:
PIN:
Home Address 1:
Home Address 2:
Home City:
Home State:
Home ZIP:
Home Country:
.....blah blah

How to write a regex that selects from Work phone till Home country
i tried this (Work*)(Country) ie select everything in between work and Country but that doesnt seem to work.Tried googling without any satisfactory answers. Please help.:cry:
G
Mar 27, 2012 at 10:18 PM
are you talking about column selection?
you need to select the text by mouse with holding alt key i guess.(not sure try ctrl + select if that not correct)
braindead
Mar 27, 2012 at 10:42 PM
you meant alt+select!
i could do that but those lines are repeated over and over, better done using a regular expression.
G
Mar 27, 2012 at 10:53 PM
try this
(Work.*try)
braindead
Mar 27, 2012 at 11:08 PM
Well according to this guy it should work:mrgreen:
or ami i reading this part wrong
eg:
Find what: (\+.*)(Item)
.* selects the text after the + up until the word "Item".

Item finds the string "Item".
@gopi not working!
coolpcguy
Mar 27, 2012 at 11:10 PM
^ that doesn't select newlines, which your selection has. I'm experimenting a bit here, let's see.
G
Mar 28, 2012 at 2:35 PM
Use Search-> Find-->Mark Tab, Enter : in search field and then check Bookmark Mark Line and Click Mark.

This will mark and bookmark the lines with :

Then Search -> Bookmark -> Remove Bookmarked Lines

That will delete all the marked lines.

You can also use a regex to search.

You also have option of Search -> Bookmark -> Remove Unmarked Line.

(Working in Notepad 5.9.4 Unicode)
braindead
Mar 28, 2012 at 7:34 PM
hmm i didnt try that but i did it finally.
for those interested, here's how
select the paragraph to be deleted

ctrl+F ( this copies the selected words and pastes to the search field)

click "find in files" and "Find all" ( this adds the \n etc for selecting new lines and stuff)

now click replace

leave the "Replace with" field empty if you're just trying to delete the repeated paragraphs like me.

click "Replace all"

Bingo!!!
:mrgreen:

@thanks to gopi and cool!!