I have a text file with lines looking like the one below : ('8510851205', 'needthishere', '', ''), I need it to remove everything and leave only needthishere on every single line. How would I do this :?
Here is what I would do.
- Search for(Search mode: Regular Expression): .',\s' Replace with: \n
- In the find window, on the "Mark" tab, bookmark (checkbox) all lines with an apostrophe in them
- a)In the Search menu, choose Bookmark, then "Inverse Bookmark"
- a)At this point, you should have your two lines bookmarked; you can go back to the same Search -> Bookmark menu and cut/copy bookmarked lines
3b)In the search menu, choose "Remove Bookmarked Lines", which will leave only the two bits you are interested in
Here is the simple regex you are looking for.
In N++, select the Replace tab in the Find window.Check the "Regular Expressions" box.
Hit the "Replace All" button.
As an example, I ran this on this file:
('8510851205', 'needthishere', '', '') ('2120986452', 'slthornton', '', ''), ('2121111111', 'strict_daddy4u', '', '')
needthishere slthornton strict_daddy4u
I could have made it shorter, but wanted to make sure we matched the full set of four strings, just in case you have parentheses looking different. Please note that this specifically assumes that the third and fourth strings are empty. If you want to allow characters in those strings, use this instead:
Wishing you a great week!