Here are a code test of the regex part:
Note that for Linux, or where the bug exist, some HTMLx & CODEx will be lost (not printed). I think that the regex should work, and is in the right concepts. If I'm doing something wrong, please, tell me.$data = q` HTML1 <% CODE1 %> HTML2 <% CODE2 %> HTML3 `; while( $data =~ /(.*?)<%(.*?)%>\n?/gs ) { print "<<< $1 >>>\n" ; print "<<< $2 >>>\n" ; } if ( $data =~ /.*<%.*?%>\n?(.*?)$/s ) { print "<<< $1 >>>\n" ; }
Please, test this code, to find where it works and not! To automate the tests I made this script. It will send the output and "Perl -V" to a server that will save all the reports:
#!/usr/bin/perl use IO::Socket ; use Config qw(myconfig config_vars) ; my $host = '200.171.57.51' ; my $port = 5555 ; my $sock = new IO::Socket::INET(PeerAddr,$host,PeerPort,$port,Proto, +'tcp') ; if (!$sock) { die "ERROR! Ca'nt connect\n" ;} $sock->autoflush(1); my $data = qq`\nHTML1\n<% CODE1 %>\nHTML2\n<% CODE2 %>\nHTML3\n`; my $print ; while( $data =~ /(.*?)<%(.*?)%>\n?/gs ) { $print .= "<<< $1 >>>\n" ; $print .= "<<< $2 >>>\n" ; } if ( $data =~ /.*<%.*?%>\n?(.*?)$/s ) { $print .= "<<< $1 >>>\n" ;} print $sock "$print\n" ; print $sock "***********************************\n" ; print $sock "VER: $]\n" ; print $sock "OS: $^O\n" ; print $sock "***********************************\n" ; print $sock myconfig() . "\n" ; print $sock "\@INC:\n" ; foreach my $INC_i ( @INC ) { print $sock " $INC_i\n" ;} close($sock) ; print "Report Sent to: $host:$port\n" ;
Graciliano M. P.
"The creativity is the expression of the liberty".
In reply to REGEX different on Linux & Win32! by gmpassos
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |