Use CTRL+R Find/Replace Dialog.
In the Find field: type \ and press CTRL+M.
In the Replace field: type ", press CTRL+M and type another ".
Execute this for the complete document.
Manually correct the first and last line.
You don't have to check regular expression. This is just a normal search and replace.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Move the cursor to the top of the file.
Press CTRL+R to use the advanced Find/Replace Dialog using the following regular expression in the Find field:
^(.+)\\$
Use the following expression in the Replace field:
"\1"
Check the Regular Expression checkbox, uncheck the Selection (NR) and Wrap checkbox.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2010-07-29
Hi… along similar lines…
What I want to do is remove all lines that contain a given string…
If I try to do it with regular expressions I cant figure out how to include the actual CR/LF characters…
Say I want to remove all lines with "xyz" in them…
What I've done is replace the following with an empty string: ^.*xyz.*$
That works fine… to get rid of the line text… but not the whole line…
So then I have to remove the new line/carriage return by switching to extended mode and replacing
\r\n\r\n for \r\n
And keep executing this replacement until all are gone (recursively).
Surely there is a better way… ideally, in a single reg exp.
I've scoured the help but I cant find any way that works for me.
Any ideas, please?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
hi all..
i have these lines in a text file
c:\program files\mozilla firefox\
c:\program files\notepad++\
c:\windows\system32\drivers\
c:\documents and settings\all users\application data\
using reg expression:
1. how do i remove all \ at the end of path in each lines
2. wrap each lines in quotes ""
thank in advanced
all, thanks alot! it works!
Use CTRL+R Find/Replace Dialog.
In the Find field: type \ and press CTRL+M.
In the Replace field: type ", press CTRL+M and type another ".
Execute this for the complete document.
Manually correct the first and last line.
You don't have to check regular expression. This is just a normal search and replace.
See also http://sourceforge.net/forum/forum.php?thread_id=1846744&forum_id=331753
Move the cursor to the top of the file.
Press CTRL+R to use the advanced Find/Replace Dialog using the following regular expression in the Find field:
^(.+)\\$
Use the following expression in the Replace field:
"\1"
Check the Regular Expression checkbox, uncheck the Selection (NR) and Wrap checkbox.
Press Find button.
Press Replace&FindAgain button.
Use a double backslash for a single backslash in regular expression mode.
The \1 indicates the found word (the complete filepath without the last backslash). It will be surrounded by double quotes.
You could even enter the driveletter between the parentheses to distinguish between different drives:
^(C.+)\\$
or more elaborate:
^(C:\\.+)\\$
Notice again that a double blackslash is used to find a single backslash in regex mode.
You've been given solutions, but it might also be worth reading http://notepad-plus.wiki.sourceforge.net/FindReplaceNewlineHowTo about potential problems if you decide to do more finding/replacing involving newlines.
Hi… along similar lines…
What I want to do is remove all lines that contain a given string…
If I try to do it with regular expressions I cant figure out how to include the actual CR/LF characters…
Say I want to remove all lines with "xyz" in them…
What I've done is replace the following with an empty string: ^.*xyz.*$
That works fine… to get rid of the line text… but not the whole line…
So then I have to remove the new line/carriage return by switching to extended mode and replacing
\r\n\r\n for \r\n
And keep executing this replacement until all are gone (recursively).
Surely there is a better way… ideally, in a single reg exp.
I've scoured the help but I cant find any way that works for me.
Any ideas, please?
Search xyz
Check "Mark line"
Mode: Normal (unless "xyz" is some regular expression)
Find all
Now all lines having xyz have a bookmark. Search -> Bookmarks -> Delete bookmarked lines.
CChris
That will do fine! ;)
Thanks CChris.
I guess I've been a little shy of using ancillary things like bookmarks…
I'll have to invest some time in getting acquainted with tricks like this.
Cheers.