my $str = "ABC[GHI]XYZ"; # Note that in actual situation string may contain several # such bracketed alphabets.