Page 1 of 1

Deleting text after a certain character in notepad++

PostPosted: May 22nd, 2013, 7:25 pm
by BlackCat
Hello. Let's say I have the following lines in n++:

Monday$29190
Tuesday$2495920
Wednesday$20569
Thursday$29459002

I want to text to be manipulated so it reads:

Monday
Tuesday
Wednesday
Thursday

I have gone to Find & Replace and entered this:
Find what: $.*
Replace with: (nothing)

The above entry only works for the first line. Every other line is deleted, reading:

Monday

Highlighting all of the text before accessing the find and replace feature yields no favorable result. I must be missing something. Can someone help me, please? I have over 5,400 lines that need this treatment and I don't want to do it all by hand, lol.

Re: Deleting text after a certain character in notepad++

PostPosted: May 23rd, 2013, 3:41 pm
by BlackCat
Never mind, I got it. I just had to uncheck the "matches newline" box. Thanks for reading. ;)

Re: Deleting text after a certain character in notepad++

PostPosted: May 23rd, 2013, 4:32 pm
by Bullet Magnet
I coded this app in C#. See if it works for you.

In your case, enter "$" (without quotes) as the string splitter, then open the file and save it once processing is complete.

Re: Deleting text after a certain character in notepad++

PostPosted: May 23rd, 2013, 7:46 pm
by BlackCat
Worked! That's so cool!!! Thanks!

Re: Deleting text after a certain character in notepad++

PostPosted: May 24th, 2013, 1:03 am
by Bullet Magnet
Wow. You literally posted that you had fixed it after I had decided to code the app, so I didn't even see that reply until just now. Oh well... Now you have two methods.

Re: Deleting text after a certain character in notepad++

PostPosted: May 24th, 2013, 8:25 am
by BlackCat
How long did it take you to code the app? I sorries, I should have edited the original post instead of replying to myself lol. Is C# coding hard?

Re: Deleting text after a certain character in notepad++

PostPosted: August 29th, 2013, 3:16 pm
by BlackCat
For those finding this topic through search engines and are disappointed to find not a clear enough answer for the above mentioned problem, here's what to do.

Go to the replace box. Make sure the regular expression box is enabled.

Find what: [$].*
Replace with: (leave blank)

This will delete everything after $. The brackets separate the symbol from being confused as regex code. If it is "cat" instead of the dollar sign, no brackets are necessary.