An answer to your question of what the regexp does ---
The regexp in the example you cite is actually "\"\\(\\(?:.\\|\n\\)*?[^\\]\\)\""
.
The parts to match are:
\"
, which matches only a"
char --- this is at the beginning and the end of the regexp.A group, which contains
\\(?:.\\|\n\\)*?
followed by[^\\]
. The group is presumably there so thatfont-lock-keywords
can be told to do something with that part of a match, i.e., the part between the matching"
at the beginning and end.\\(?:.\\|\n\\)*?
, the first part of the group, matches zero or more characters --- any characters. The*?
could be just*
(same thing). The.
matches any char except a newline char, and the\n
matches a newline char. The\\|
means either of those is OK.[^\\]
matches any character except a backslash (\
).
So putting it together, the group matches zero or more chars followed by a char that is not a backslash. Why not just use a regexp that matches zero or more chars between "
chars? Presumably because the person wanted to make sure the ending "
was not escaped (by a backslash). However, note that the regexp requires there to be at least one char between the "
chars, so that regexp does not match the empty string, ""
.
A good resource is: http://www.emacswiki.org/emacs/RegularExpression.