in reply to Re^2: replacing code with regex
in thread replacing code with regex
Anyway changing
... to ...(\W*?) # this shouldn't be necessary since whitespace should have be +en slurped on previous line but this shouldn't hurt either
fixes it. Horrah. $1 printed 'isitvalid("templatefile.html")' when I tested it(\s*?) # this shouldn't be necessary since whitespace should + have been slurped on previous line but this shouldn't hurt either
Anyway \s is a more standard way of matching whitespace, so I guess you could get milage out of changing all your instances of \W*?, which are probably matching more than you expect. Case in point.
my $test = '{}[]£$%'; my $match = ($test =~ m/(\W*)/)[0]; print $match; __OUTPUT__ {}[]£$%
|
|---|