in reply to Regex with HTML::Entities

This works for me:
use v5.12; use warnings; use HTML::Entities; use Data::Dump qw/pp dd/; use utf8; my $sep = decode_entities('&#10038;'); 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 = "<div>some Text $b some other text</div>"; $text =~ s/$c/$r/sg; pp $text;

-*- mode: compilation; default-directory: "d:/tmp/pm/" -*- Compilation started at Tue Nov 23 13:06:24 C:/Strawberry/perl/bin\perl.exe -w d:/tmp/pm/nominal_flexion.pl "{\x{2736}Adjektive (Nominalflexion)~87\x{2736}} foo \n{\x{2736}Adjekt +ive (Nominalflexion)~87\x{2736}}" "<div>some Text Adjektive (Nominalflexion)~87 some other text</div> fo +o \n<div>some Text Adjektive (Nominalflexion)~87 some other text</div +>" Compilation finished at Tue Nov 23 13:06:24

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery