Changed regualr expression matching headings to accept white space before end of line