The first "^" means: at the start of a line.
The [^#] means: any character EXCEPT a "#" because when ^ is the first character inside [these brackets] it means NOT the next character(s).
Sasha
PS - look up "man 7 regex" or "man regex" or Google "regular expressions" for much more