In Visual Studio, you can find EOF as follows: $(?![\r\n]) . This works whether your line endings are CR, CRLF or just LF.
As a bonus, you can ensure that all of your code files have the final newline marker, for example:
Find What: (?<![\r\n])$(?![\r\n]) Replace With: \r\n Use Regular Expressions: checked Look at these file types: *.cs, *.cshtml, *.js
How it works:
Find any end of the line (zero-width match) that is not preceded by CR or LF, and CR or LF does not follow. Some thought will show you why this works!
Note that you must replace your desired line termination character, be it CR, LF, or CRLF.
ErikE Jan 23 '16 at 1:54 on 2016-01-23 01:54
source share