- AuthorPosts
- July 14, 2014 at 5:59 pm #18675JamilParticipant
I had a need to search for the number of carriage returns that exist in a text file. This is a carriage return only and not CR+LF combination. I opened up the text file in EmEditor version 14.5.3, opened up the find dialog, checked off:
Use Regular Expressions
Move to Start/End of Document
Count MatchesFor search criteria, I entered: \r
When I click either find next or find all, I get really unusual results. It stated that 8,984 matches were found. This number is incorrect, since there are roughly 134 carriage return characters in the file.
Is it possible to fix this?
Thanks.
July 14, 2014 at 11:00 pm #18676StefanParticipant\r is right, basically.
But for EE us rather \n, no matter if for CR or CRLFSee help
EmEditor Home – EmEditor Help – How to – Search
To Specify New LinesAn good indicator are also the line numbers (View > Line Numbers)
and also View > Marks > Returns
and View > Marks > CR and LF with different Marks.
July 15, 2014 at 1:50 pm #18678JamilParticipantIn regular expressions, a carriage return is indicated by \r. \n is a newline character. This is standard everywhere. So, this is by design?
The C++ standard library implements regular expressions correctly, so in the worst case scenario, I could look into creating a plugin that does it.
July 15, 2014 at 4:10 pm #18679Yutaka EmuraKeymasterHello Jamil,
To correctly find CR only lines, please use Find in Files (not normal Find), click the “>” button next to the File Types, and select “Current File”.
Then check Use Regular Expressions, and find:
\r(?!\n)
This will find all files with CR only.
I hope this helps.
Thank you!
- AuthorPosts
- You must be logged in to reply to this topic.