Below, the comments of each of the languages are described. The patterns are available as $RE{comment}{LANG}, foreach language LANG. Some languages have variants; it's described at the individual languages how to get the patterns for the variants. Unless mentioned otherwise, {-keep} sets $1, $2, $3 and $4 to the entire comment, the opening marker, the content of the comment, and the closing marker (for many languages, the latter is a newline) respectively.

In Algol 68, comments are either delimited by #, or by one of the keywords co or comment. The keywords should not be part of another word. See http://westein.arb-phys.uni-dortmund.de/~wb/a68s.txt. With {-keep}, only $1 will be set, returning the entire comment.

The esotoric language Beatnik only uses words consisting of letters. Words are scored according to the rules of Scrabble. Words scoring less than 5 points, or 18 points or more are considered comments (although the compiler might mock at you if you score less than 5 points). Regardless whether {-keep}, $1 will be set, and set to the entire comment. This pattern requires perl 5.8.0 or newer.

The C++ language has two forms of comments. Comments that start with // and last till the end of the line, and comments that start with /*, and end with */. If {-keep} is used, only $1 will be set, and set to the entire comment.

The Cg language has two forms of comments. Comments that start with // and last till the end of the line, and comments that start with /*, and end with */. If {-keep} is used, only $1 will be set, and set to the entire comment. See http://developer.nvidia.com/attach/3722.

There are two types of comments in Dylan. They either start with //, or are nested comments, delimited with /* and */. Under {-keep}, only $1 will be set, returning the entire comment. This pattern requires perl 5.6.0 or newer.

The FPL language has two forms of comments. Comments that start with // and last till the end of the line, and comments that start with /*, and end with */. If {-keep} is used, only $1 will be set, and set to the entire comment.

There are two forms of Fortran. There's free form Fortran, which has comments that start with !, and end at the end of the line. The pattern for this is given by $RE{Fortran}. Fixed form Fortran, which has been obsoleted, has comments that start with C, c or * in the first column, or with ! anywhere, but the sixth column. The pattern for this are given by $RE{Fortran}{fixed}.

There are two types of comments in Haskell. They either start with at least two dashes, or are nested comments, delimited with {- and -}. Under {-keep}, only $1 will be set, returning the entire comment. This pattern requires perl 5.6.0 or newer.

In HTML, comments only appear inside a comment declaration. A comment declaration starts with a <!, and ends with a >. Inside this declaration, we have zero or more comments. Comments starts with -- and end with --, and are optionally followed by whitespace. The pattern $RE{comment}{HTML} recognizes those comment declarations (and hence more than a comment). Note that this is not the same as something that starts with <!-- and ends with -->, because the following will be matched completely:

<!-- First Comment --
--> Second Comment <!--
-- Third Comment -->

Do not be fooled by what your favourite browser thinks is an HTML comment.

There are two types of comments in Hugo. They either start with ! (which cannot be followed by a \), or are nested comments, delimited with !\ and \!. Under {-keep}, only $1 will be set, returning the entire comment. This pattern requires perl 5.6.0 or newer.

Comments in INTERCAL are single line comments. They start with one of the keywords NOT or N'T, and can optionally be preceded by the keywords DO and PLEASE. If both keywords are used, PLEASE precedes DO. Keywords are separated by whitespace.

The Java language has two forms of comments. Comments that start with // and last till the end of the line, and comments that start with /*, and end with */. If {-keep} is used, only $1 will be set, and set to the entire comment.

This is the pattern that recognizes comments according to the Pascal ISO standard. This standard says that comments start with either {, or (*, and end with } or *). This means that {*) and (*} are considered to be comments. Many Pascal applications don't allow this. See http://www.pascal-central.com/docs/iso10206.txt

The Delphi Pascal, Free Pascal and the Gnu Pascal Compiler implementations of Pascal all have comments that either start with // and last till the end of the line, are delimited with { and } or are delimited with (* and *). Patterns for those comments are given by $RE{comment}{Pascal}{Delphi}, $RE{comment}{Pascal}{Free} and $RE{comment}{Pascal}{GPC} respectively. These patterns only set $1 when {-keep} is used, which will then include the entire comment.

The Workshop Pascal compiler, from SUN Microsystems, allows comments that are delimited with either { and }, delimited with (*) and *), delimited with /*, and */, or starting and ending with a double quote ("). When {-keep} is used, only $1 is set, and returns the entire comment.

The SLIDE language has two froms of comments. First there is the line comment, which starts with a # and includes the rest of the line (just like Perl). Second, there is the multiline, nested comment, which are delimited by (* and *). Under C{-keep}>, only $1 is set, and is set to the entire comment. See http://www.cs.berkeley.edu/~ug/slide/docs/slide/spec/spec_frame_intro.shtml.

Standard SQL uses comments starting with two or more dashes, and ending at the end of the line.

MySQL does not follow the standard. Instead, it allows comments that start with a # or -- (that's two dashes and a space) ending with the following newline, and comments starting with /*, and ending with the next ; or */ that isn't inside single or double quotes. A pattern for this is returned by $RE{comment}{SQL}{MySQL}. With {-keep}, only $1 will be set, and it returns the entire comment.

This module is free software, and maybe used under any of the following licenses:

1) The Perl Artistic License. See the file COPYRIGHT.AL.
2) The Perl Artistic License 2.0. See the file COPYRIGHT.AL2.
3) The BSD License. See the file COPYRIGHT.BSD.
4) The MIT License. See the file COPYRIGHT.MIT.