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.
精彩评论