Q:

How to remove single quotation mark from a String using REGEX

I used this below expression
s/^'|'$//

Just I am expecting the below result
'value' --> value (Without single quotation marks)
but in my expression the result is given as value'
it only removes the first occurrence only.
How can I fix that ?

A:

As commented by @WiktorStribiżew and @lurker, without the /g modifier, the s/// operator will only operate on the first (left-to-right) occurrence that it matches. See perlretut for more info.
As an alternative it may be simpler to run it as two regexes (this is commonly done for trim implementations):
do { s/^'//; s/'$// } for $val;

