If you want to delete all the text after a character or string (to the right) in Notepad++ you would need to make use of regex.
Let's say I have the text below which has a colon at each line and I do not want any text after the char colon (:)
Text:1 - New York, New York: 8,336,817 8,175,133 8,008,278 7,322,564
2 - Los Angeles, California: 3,979,576 3,792,621 3,694,820 3,485,398
3 - Chicago, Illinois: 2,693,976 2,695,598 2,896,016 2,783,726
4 - Houston, Texas: 2,320,268 2,100,263 1,953,631 1,630,553
5 - Phoenix, Arizona: 1,680,992 1,445,632 1,321,045 983,403
6 - Philadelphia, Pennsylvania: 1,584,064 1,526,006 1,517,550 1,585,577
7 - San Antonio, Texas: 1,547,253 1,327,407 1,144,646 935,933
8 - San Diego, California: 1,423,851 1,307,402 1,223,400 1,110,549
9 - Dallas, Texas: 1,343,573 1,197,816 1,188,580 1,006,877
10 - San Jose, California: 1,021,795 945,942 894,943 782,248
11 - Austin, Texas: 978,908 790,390 656,562 465,622
12 - Jacksonville, Florida: 911,507 821,784 735,617 635,230
Press Ctrl + Shift + F to open Find window, move to Replace Tab, Find :.* and Replace With: (keep it blank), make sure to keep Search Mode as Regular Expression,
Output:1 - New York, New York
2 - Los Angeles, California
3 - Chicago, Illinois
4 - Houston, Texas
5 - Phoenix, Arizona
6 - Philadelphia, Pennsylvania
7 - San Antonio, Texas
8 - San Diego, California
9 - Dallas, Texas
10 - San Jose, California
11 - Austin, Texas
12 - Jacksonville, Florida
So, simply add .* to delete all characters after the string or character on each that you want to delete from a line.
Related Questions:- To delete after character: (char).*
- To delete after string?: (your-string).*
- To delete after word? : (your-word).*
- To delete after space? : \s.*
- To delete after comma? : ,.*
- To delete after semi-colon? : ;.*
- To delete after pipe? : \|.*
Provide Feedback For This Article
We take your feedback seriously and use it to improve our content. Thank you for helping us serve you better!
😊 Thanks for your time, your feedback has been registered!
Comments & Discussion
Facing issues? Have questions? Post them here! We're happy to help!