Reputation: 6793
I have a file containing many instances of block text that are $ separated. After each $ sign, there is a line break. How do I remove this line break after each dollar sign using the Regex search option in Notepad ++?
Update on Bohemians answer:
Upvotes: 6
Views: 33769
Reputation: 2626
That's what worked for me.
Search: $[\n\r]+
Replace:
the Replace is not empty, it's one space stroke [space]
Upvotes: 4
Reputation: 425328
You would need to escape the $
:
Search: \$[\n\r]+
Replace: $
Without escaping, $
means "end of line".
Upvotes: 5
Reputation: 91518
Use the Extended mode
, not Regular Expresssion
and you can do:
Find what: $\n
Replace with: $
Upvotes: 0
Reputation: 174836
Use a lookbehind to match all the newline characters which are next to the $
symbol. Replacing the matched \n
characters with empty string will give you the desired result.
(?<=\$)\n
If you want to remove one or more newline characters present just after to $
then add a +
after \n
in your regex.
(?<=\$)\n+
Use the below regex if you want to remove one or more new line or carriage return characters.
(?<=\$)[\r\n]+
Upvotes: 0