http://qs321.pair.com?node_id=1185365


in reply to Replace a string that contains special characters

If you don't really care about leaving the JSON intact, your problem at hand seems to be that Perl regards { and [ and . as special within regular expressions.

To temporarily switch off the special treatment, see the \Q and \E escapes in perlre. Basically, your regexp could be written as:

s/\Q{"absoluteLimits":{"conditionalLimits":[{"bidirVolume":102400000," +name":"Home"}],"resetPeriod":{"volume":"2400 hours"}},"description":" +Promotion_tariffbasic:\E.*//s

(find where I added \Q and \E in the Perl code)