NAME
Regexp::Common::comment -- provide regexes for comments.
SYNOPSIS
use Regexp::Common qw /comment/;
while (<>) {
/$RE{comment}{C}/ and print "Contains a C comment\n";
/$RE{comment}{C++}/ and print "Contains a C++ comment\n";
/$RE{comment}{PHP}/ and print "Contains a PHP comment\n";
/$RE{comment}{Java}/ and print "Contains a Java comment\n";
/$RE{comment}{Perl}/ and print "Contains a Perl comment\n";
/$RE{comment}{awk}/ and print "Contains an awk comment\n";
/$RE{comment}{HTML}/ and print "Contains an HTML comment\n";
}
use Rexexp::Common qw /comment RE_comment_HTML/;
while (<>) {
$_ =~ RE_comment_HTML() and print "Contains an HTML comment\n";
}
DESCRIPTION
Please consult the manual of Regex::Common for a general description of the works of this interface.
Do not use this module directly, but load it via Regex::Common.
This modules gives you regular expressions for comments in various languages.
Available languages are:
$RE{comment}{Ada}
$RE{comment}{awk}
$RE{comment}{C}
$RE{comment}{C++}
$RE{comment}{Dylan}
$RE{comment}{Eiffel}
$RE{comment}{Haskell}
$RE{comment}{HTML}
$RE{comment}{Java}
$RE{comment}{LaTeX}
$RE{comment}{LPC}
$RE{comment}{Perl}
$RE{comment}{PHP}
$RE{comment}{Python}
$RE{comment}{REBOL}
$RE{comment}{Ruby}
$RE{comment}{shell}
$RE{comment}{Smalltalk}
$RE{comment}{SQL}
$RE{comment}{SQL}{MySQL}
$RE{comment}{Tcl}
$RE{comment}{TeX}
$RE{comment}{troff}
$RE{comment}{vi}
$RE{comment}{zonefile}
$RE{comment}{vi}
is a regular expression matching comments used in vi's startup file .exrc, while $RE{comment}{zonefile}
is a regular expression matching comments in zonefiles for bind.
For HTML, the regular expression captures what's known in SGML as a comment declaration. It starts with a <!
, ends with a >
and contains zero or more comments. Each comment starts and end with --
. See also [Go 90].
If we are using C{-keep} (See Regexp::Common):
- For Ada, awk, C, Eiffel, LaTeX, LPC, Perl, Python, REBOL, Ruby, shell, Smalltalk, SQL, TeX, Tcl, troff, vi and zonefile:
- For C++, Dylan, Haskell, Java, PHP and SQL_MySQL:
- For HTML
REFERENCES
- [Go 90]
-
Charles F. Goldfarb: The SGML Handbook. Oxford: Oxford University Press. 1990. ISBN 0-19-853737-9. Ch. 10.3, pp 390-391.
SEE ALSO
Regexp::Common for a general description of how to use this interface.
AUTHOR
Damian Conway (damian@conway.org)
MAINTAINANCE
This package is maintained by Abigail (regexp-common@abigail.nl).
BUGS AND IRRITATIONS
Bound to be plenty.
For a start, there are many common regexes missing. Send them in to regexp-common@abigail.nl.
COPYRIGHT
Copyright (c) 2001 - 2002, Damian Conway. All Rights Reserved.
This module is free software. It may be used, redistributed
and/or modified under the terms of the Perl Artistic License
(see http://www.perl.com/perl/misc/Artistic.html)