• CONTEST ALERT - Experience the power of DDR5 memory with Kingston Click for details

Notepad++ regex help

braindead

Bankaiiiii
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:
 

gopi_vbboy

Cyborg Agent
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)
 
OP
braindead

braindead

Bankaiiiii
you meant alt+select!
i could do that but those lines are repeated over and over, better done using a regular expression.
 
OP
braindead

braindead

Bankaiiiii
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

Resistance is Futile.
^ that doesn't select newlines, which your selection has. I'm experimenting a bit here, let's see.
 

gopi_vbboy

Cyborg Agent
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)
 
OP
braindead

braindead

Bankaiiiii
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!!
 
Top Bottom