I have a text file with some configuration value. There a comment starts with a # I am trying to find a regular expression pattern that will find out all the lines that star
You can simply write:
preg_match_all('~^#.*~m', $text, $m);
since the quantifier is greedy by default and the dot doesn't match newlines by default, you will obtain what you want.