in reply to Passing a regex from a CGI HTML form

OK, is this any better?:

if (length ($request{'find'}) > 0 ) { $find=$request{'find'}; $replace=$request{'replace'}; while ($line =~ m{(.*)$find(.*)}){ $line = $1 . $replace . $2; } }

Nick

Replies are listed 'Best First'.
Re^2: Passing a regex from a CGI HTML form UPDATE
by hippo (Archbishop) on Sep 04, 2016 at 12:06 UTC

    Yes, that looks a good deal better - assuming you are running in taint mode.

    Now try and break it. :-)

      Yes, running with -T option. All looks good, haven't broken anything yet ;) It is perfect for what I need, as it will only be simple substitutions required anyway (when they happen) just to keep the parser working when at work.

      Thanks everybody for their help and input on this subject, I learnt a lot

      Nick