in reply to Print what regex finds or invert regex for substitution

http://learn.perl.org/faq/perlfaq6.html#How-do-I-use-a-regular-expression-to-strip-C-style-comments-from-a-file-

In the substitution part $2 holds the match-group you do not seem to want.

So take one of the other groups!

Could be that you will need to add new groups with parens: ( regexes ), shouldn't be too complicated cause this regex is really well documented.

see perlretut#Extracting matches for about how grouping and numbered vars work.

Cheers Rolf

Replies are listed 'Best First'.
Re^2: Print what regex finds or invert regex for substitution
by BrianBSL (Initiate) on Mar 17, 2012 at 20:54 UTC
    Thanks very much! That worked.