in reply to Another Regular Expression
If you know (or test) that the first and last characters are quotes then you can use substr to isolate those from conversion:
my $string = '"I have a 15" latter and a 6" foot arm."'; substr( $string, 1, -1 ) =~ s["]["]g; print $string; "I have a 15" latter and a 6" foot arm."
Or, you can use a lookbehind and a lookahead assertion to prevent the first and last characters being touched:
my $string = '"I have a 15" latter and a 6" foot arm."'; $string =~ s[(?<=.)"(?=.)]["]g; print $string; "I have a 15" latter and a 6" foot arm."
BTW. What is a '15" latter'?
|
|---|