in reply to remove first and last character of string
As with others who have commented in this thread, it's not clear to me just what flieckster wants to achieve.
If, and it's a big if, the aim is to remove double-quotes
only when they are paired at both the start and end of the
string and never in any other circumstance, then
qr{ (?| \A " (.*) " \z | (.*)) }xms # needs 5.10+
will do the trick. With this regex,
'""' '""""' '"foo"' '"fo"o"' '"f"o"o"'
become
'' '""' 'foo' 'fo"o' 'f"o"o'
respectively, while strings like
'' '"' '"foo' 'foo"' 'f"oo' 'f"o"o'
are unchanged.
Note that this regex needs Perl version 5.10+ because it uses the (?|...) branch reset regex extension. The regex can be made to work in pre-5.10 versions by removing the (?|...) and adding a grep defined, ... filter to the output of the regex match.
Give a man a fish: <%-{-{-{-<
|
|---|