use v5.12; use warnings; use HTML::Entities; use Data::Dump qw/pp dd/; use utf8; my $sep = decode_entities('✶'); my $pat = "{${sep}Adjektive (Nominalflexion)~87$sep}"; my $text = join " foo \n", ($pat) x 2; pp $text; my $b = "Adjektive (Nominalflexion)~87"; my $c = "\Q{$sep$b$sep}\E"; my $r = "
some Text $b some other text
"; $text =~ s/$c/$r/sg; pp $text;