#!/usr/bin/perl my $input = "ABCDACD{ACDA}ABCD";$input =~ s/({.*?})|(A)/{$2 ? "B" : $1}/ge;print $input;
Standard input is empty
BBCDBCD{ACDA}BBCD
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!