On Jun 6, David Gilden said:
> m#^/\*# .. m#^\*/#; # using the range operator
>
>match (# is the delimiter)
>at the start of a line /\* (and this where I lose it!)
Let's feed this through 'explain', shall we?
friday:~ $ explain
^/\*
[snip]
NODE EXPLANATION
----------------------------------------------------------------------
(?-imsx: group, but do not capture (case-sensitive)
(with ^ and $ matching normally) (with . not
matching \n) (matching whitespace and #
normally):
----------------------------------------------------------------------
^ the beginning of the string
----------------------------------------------------------------------
/ '/'
----------------------------------------------------------------------
\* '*'
----------------------------------------------------------------------
) end of grouping
----------------------------------------------------------------------
And the other regex is very like it -- match '*/' at the beginning of a
line again.
This program is used for printing all lines of a C program, EXCEPT those
that start with a C-comment starter, end with a C-comment ender, and any
in between.
Basically, it removes any only-comment lines of a program.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
I am Marillion, the wielder of Ringril, known as Hesinaur, the Winter-Sun.
Are you a Monk? http://www.perlmonks.com/ http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter. Brother #734
** Manning Publications, Co, is publishing my Perl Regex book **