happy new year to all,..
i've a qn.,:)
i want to 'insert' an escape character for every '[' & ']'
i will find in a variable..
Suppose $temp has a word which might contain [ and/or ].
Eg: if $temp has hello]
the modified temp should have hello\]
if $value has [hello] i want the result to be \[hello\].
Is there a quick one line regex to do this?
i'm able to match the presence of [ & ]
if( (/\[/)|(/\]/) ){
my $value = $_;
$value =~ s/\[/\\\[/;
$value =~ s/\]/\\\]/;
print $value;
}
Kinda doing the stuff,but i just checkign out a 1 liner reg-ex.
regards
-ajey
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>