in reply to text matching
Can you give the context you are using this snippet in? When I use it, everything looks as you expected except that #include "report.h" is retained.
That being said, there do seem to be some issues with the regex. Based on your description of what you want to accomplish, why not just use something like this:
while(my $line = <$in>) { $line =~ s/ .* report [s]? .* ; .* //sx; print $line; }
It gives the following output:
#include <stdio.h> #include "report.h" void main() { #ifdef CHECK_REPORT #endif #if defined (REPORT_ENABLE) #endif printf("The execution is completed\n"); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: text matching
by prassi (Acolyte) on Jun 16, 2012 at 06:17 UTC | |
by frozenwithjoy (Priest) on Jun 16, 2012 at 06:30 UTC | |
by prassi (Acolyte) on Jun 16, 2012 at 06:54 UTC | |
by frozenwithjoy (Priest) on Jun 16, 2012 at 07:09 UTC | |
by prassi (Acolyte) on Jun 16, 2012 at 07:20 UTC | |
| |
by Cristoforo (Curate) on Jun 17, 2012 at 01:13 UTC |