开发者

[\t\s ]+\r|[\t\s ]+\n|[\t\s ]+\r|[\r\n]+ not able to catch empty lines in plain text document

开发者 https://www.devze.com 2023-04-06 07:53 出处:网络
Beginning to use perl RegExp.I am using the following RegExp to catch unwanted blank lines in a plain text document. Still some lines are left not cau开发者_如何学Goght. Where am I going wrong

Beginning to use perl RegExp.I am using the following RegExp to catch unwanted blank lines in a plain text document. Still some lines are left not cau开发者_如何学Goght. Where am I going wrong

[\t\s ]+\r|[\t\s ]+\n|[\t\s ]+\r|[\r\n]+


Can't you just use /^\s*$/? (a line containing zero or more white-space characters only) You shouldn't try to match newline with \n or \r, use $ (end of line) instead.

0

精彩评论

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