开发者

eclipse search - regex finding start/end of file with carriage return

I would like to remove any line breaks/carriage returns at the start and end of files but eclipse doesn't seem to recognize $$ or ^^ for end/start of file. Anyone know how to do a regex with eclipse se开发者_运维技巧arch?


sof ^^ Start of File
eof $$ End of File


You can use \A to represent the start of the file, and \Z to represent the end of the file.


It seems by default, the multi-line flag m is enabled in Eclipse, causing ^ and $ to match start- and end-of-lines. You can disable the m flag by adding (?-m) in front of your regex.

I just tested it, and it only removes line breaks at the start or end of the file:

(?-m)(^\s+|\s+$)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜