in reply to Re^2: replacing code with regex
in thread replacing code with regex

As you followed my advice I could hardly not try and help!

Anyway changing

(\W*?) # this shouldn't be necessary since whitespace should have be +en slurped on previous line but this shouldn't hurt either
... to ...
(\s*?) # this shouldn't be necessary since whitespace should + have been slurped on previous line but this shouldn't hurt either
fixes it. Horrah. $1 printed 'isitvalid("templatefile.html")' when I tested it

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__ {}[]£$%
---
my name's not Keith, and I'm not reasonable.