#!/usr/bin/perl read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @input = split(/&/, $buffer); for $i (@input) { ($name, $value) = split(/=/, $i); $name =~ tr/+/ /; $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $g{$name} = $value; } $checkm = $g{'type'} eq 'm' ? ' checked' : ''; $checks = $g{'type'} eq 's' ? ' checked' : ''; if ($checkm eq $checks) {$checkm = ' checked'} if ($checkm) {$cgvis = 'visible';$evis = 'hidden';$subvis = 'hidden';$g{'sub'} = '';$subheight=0;$che = '';undef $g{'e'}} else {$cgvis = 'hidden';$evis = 'visible';$subvis = 'visible';$subheight=9;$chcg = '';undef $g{'cg'}} $go = 2; if ($g{'string'} || $g{'regex'}) { $go = 0; if ($g{'i'}){$chi = ' checked';push @mods,'i'} if ($g{'m'}){$chm = ' checked';push @mods,'m'} if ($g{'s'}){$chs = ' checked';push @mods,'s'} if ($g{'x'}){$chx = ' checked';push @mods,'x'} if ($g{'o'}){$cho = ' checked';push @mods,'o'} if ($g{'g'}){$chg = ' checked';push @mods,'g'} if ($g{'cg'}){$chcg = ' checked';push @mods,'cg'} if ($g{'e'}){$che = ' checked';push @mods,'e'} $m = join("",@mods); $file = (int rand 1000000000) . '.pl'; open (FILE, ">$file"); if ($g{'type'} eq 'm') {$regprint = "\@output = (\"$g{'string'}\" =~ /$g{'regex'}/$m);\n\$output = (\"$g{'string'}\" =~ /$g{'regex'}/$m);\n"} else {$regprint = "(\$output = \"$g{'string'}\") =~ s/$g{'regex'}/$g{'sub'}/$m;\n"} print FILE <" : (scalar @output) . " matches
" ) : "Did not find a match
"} else {$result = "Input string becomes $output
"} } print "Content-Type: text/html\n\n"; print < p e r l     r e g e x     t e s t e r
   
Input string:
Regex type:       
Regular Expression:
Substitute String:
Modifiers:                            
Preview Code:
$aa END if ($go == 1) { print < Result: $result
END if ($before || $match || $after) { print < \$` = $before \$& = $match \$' = $after END } $count = 1; for $i (@dynamics) { print < \$$count = $i END $count++ } print < END } elsif ($go == 2) { print < END } else { print < SORRY, THAT REGEX BROKE. PLEASE TRY ANOTHER ONE END } print < this page is part of Sherston's Progress END unlink $file;