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

You overestimate me! Highly commented code still leaves me stumped. Anyone want to jump in here?

Replies are listed 'Best First'.
Re^3: replacing code with regex
by reasonablekeith (Deacon) on May 11, 2005 at 18:34 UTC
    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.