Usually you do not consider comments as a line of code, but this can be a useful metric, so perhaps you should keep track of their number when analyzing the file.
You better check lines that are not spaces, and end CRLF without continuing the char line. Regex says that this means you want to avoid such lines (assuming backslash is a continuation of your char line):
\\\s*\n\r
if you find such a line, do not increase the counter. Of course, a regular expression may vary depending on which language (engine) you use, and using a regular expression may not even be the most appropriate way - a simple state mechanism might be better.
source share