Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Inserting CRLF into a string sequence in Notepad ++

I have a text file that has incorrectly placed line breaks. The position where the line break should be placed goes like this …xxxXxxx… (every x is a character [a-z] with the capital X being a capital character [a-z]. I want to place the CRLF in front of the capital letter. How do I do it? I can find all these sequences by Find what: [a-z][A-Z][a-z] (match case 1) but I don’t know what to type in the Replace with field to keep the original text.

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

  • Ctrl+H
  • Find what: (?<=[a-z])(?=[A-Z])
  • Replace with: \r\n
  • CHECK Match case
  • CHECK Wrap around
  • CHECK Regular expression
  • Replace all

Explanation:

(?<=[a-z])      # positive lookbehind, make sure we have a lowercase letter before
(?=[A-Z])       # positive lookahead, make sure we have an uppercase letter after

Replacement:

\r\n            # CRLF

Screenshot (before):

enter image description here

Screenshot (after):

enter image description here

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading