Changes regular expression matching headings to allow white space before...

I had white space after text and before new line character in my markdown's headings. So the regular expression would not match any heading at all.
I changed the regular expression to allow matching headings with (or without) white space before end of line.
Please review.
Thank you in advance.