Eule2000
Eule2000

Reputation: 29

Notepad++ Regular Expressions find&remove

Need some help in Notepad++

Example how it looks at the moment

http://www.test.com/doc/rat.rar">rat.rar
http://www.test.com/down/ung.rar">ung.rar
http://www.test.com/read/add.rar">add.rar

......

How I want it (just remove after ">....rar)

http://www.test.com/doc/rat.rar
http://www.test.com/down/ung.rar
http://www.test.com/read/add.rar

Its a list about 1000 lines. So help would be nice

Upvotes: 1

Views: 929

Answers (7)

Andy E
Andy E

Reputation: 344517

Use the following expression:

">[^.]+\.rar

Explanation:

">        # literal `"` followed by literal `>`
[^.]+     # any character that is not a `.`, repeated at least once 
\.        # literal `.` character
rar       # literal string `rar`


Note: a couple of other answers pointed out that just ">.* will work. This is true, because Notepad++ doesn't appear to support multi-line regular expressions, even with [\s\S]+. Either way will work so it's personal preference. The regex I gave in this answer is very verbose and would reduce the likelihood of false positives. ">.*, on the other hand, is shorter.

Upvotes: 1

Jayendra
Jayendra

Reputation: 52769

Use -

Find What : (.*)">(.*)
Replace With : \1

And check Regular expression option at the bottom of the dialog.

Upvotes: 0

FailedDev
FailedDev

Reputation: 26930

">.*

Search for this and replace with nothing.

Upvotes: 1

ean5533
ean5533

Reputation: 8994

Flick the "regular expression" radio button and then use this for your FIND:

">[a-z]+\.[a-z]+

Then just put empty space for your REPLACE and replace all.

Upvotes: 0

ipr101
ipr101

Reputation: 24236

If you put this in find ".* and nothing in replace, that should do what you're looking for.

Remember to check that you've got regex selected at the bottom of the replace box.

Upvotes: 0

Polynomial
Polynomial

Reputation: 28316

Your search string should be ">.+\.rar, and you can just blank out the replace box. This should do the job.

Also, check that you've got regex selected at the bottom of the replace box ;)

Upvotes: 0

Molochdaa
Molochdaa

Reputation: 2218

In regexp mode , replace pattern ">.* with empty string.

Upvotes: 1

Related Questions