Open ullenboom opened 11 years ago
The current regular expression used to find the comments is broken. It reads:
"^/\*.*?\*|\s+/\*.*?\*/"
This matches either:
^
) start at /*
, match the shortest string of any characters (.*?
) followed by a star (*
)|
)\s+
) followed by /*
, followed by the shortest string of any characters (.*?
), followed by */
.Notice that the first case ends the match in *
, not in */
. This is what happens in your example, where the match ends with the lone *
and the Community */
part is left over.
When you add an empty line before the comment string, the second case comes into action which (more correctly) matches <whitespace> '/*' <any characters> '*/'
In commit 52986720be61f1387ae8cd4edbba2ddbcbb74ded editor Michael Klier simply describes his change as "fixed regex" and does not explain why he exchanged a simple regex, which by the way also includes a match with comments of the style
// One-line comment
with a more complicated one which only allows a comment which either starts at the beginning of a line or is preceded by whitespace. And which is broken :frowning:
This could also be fixed by the change suggested in #12. Please test.
->
Community */
so the line plus */ stays. I can fix this by inserting an empty line although its just a fix for a parser imperfection.