in reply to Passing a regex from a CGI HTML form
OK, I changed tact and looked for a way to use $var's in the substition. I found a post on stackoverflow that works 'perfectly' for my precise requirements.
On the HTML form, have two 'input type="text"' boxes. One is for the text to find, the second is for the text to replace.
The perl code is as follows:
if ($request{'find'} && $request{'replace'}) { $find=$request{'find'}; $reptemp=$request{'replace'}; $replace='$reptemp'; $line =~ s/$find/$replace/ee; }
Bingo, all works great, and no "Danger, Will Robinson" type stuff :)
Nick
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Passing a regex from a CGI HTML form [SOLVED]
by Anonymous Monk on Sep 01, 2016 at 19:09 UTC | |
by Linicks (Scribe) on Sep 01, 2016 at 19:24 UTC | |
by Anonymous Monk on Sep 01, 2016 at 20:05 UTC | |
by Linicks (Scribe) on Sep 02, 2016 at 15:05 UTC | |
by Anonymous Monk on Sep 02, 2016 at 21:17 UTC |