On Mon, 29 Oct 2001, P.Agenbag wrote:
>
Hi , I posted a question earlier today
regarding stripping slashes from variables. The problem arises when we
gather info from a web form and the user input contains quotes ( " or ' )
. When the string is then used at a later
Does this do the trick?
#!/usr/bin/perl -w
use strict;
my $string=q#Strip the \'slashes\' from the \"string\" if\and\only\if
they're followed by a ' or ".#;
print "Before: $string\n";
$string=~s#\\(['"])#$1#g; # match a \ followed by either a ' or ", and
replace with just the ' or "
print "After:
Hi , I posted a question earlier today regarding stripping slashes from
variables. The problem arises when we gather info from a web form and
the user input contains quotes ( " or ' ) . When the string is then used
at a later stage ( mailed or echoed to screen) , the quotes all have \"
or