M BUZZ CRAZE NEWS
// news

Replace CRLF in Notepad++ using regex

By Jessica Wood

I want to remove CRLFs before a selected word [[orange]] and can use \r\n [CR=\r, LF=\n], but the number of CRLFs available before [orange] is unknown.

Is there any regex available that I can use to remove all CRLFs before [orange] using Notepad++?

1 Answer

Just use * to look for zero or more occurrences of the previous object

(\r\n)*\[orange\]

For 1 or more instances use + instead of *

(\r\n)+\[orange\]

[ and ] are special characters denoting character class so they must be escaped when looking for the literal square brackets

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy