Hi Monks,
I have a question concerning Regex with HTML::Entities. I try to replace patterns with a keyword with some HTML-Code: The keword is encapsulated between ✶ (a little star). The keyword itself is of the form: Adjektive (Nominalflexion~84. The whole pattern looks like: {✶Adjektive (Nominalflexion)~87✶}
use HTML::Entities; # $text is some Text from a mysql database my $sep = decode_entities('✶'); my @v = ($text =~ /\{$sep(.*?)$sep\}/sg); # alle Verweise # @v contains all patterns (which means that they match)
The matched elements in @v have the form: {✶Adjektive (Nominalflexion)~87✶} Going through all elements in @v, I try to replace the matched elements in the following way:
$b = "Adjektive (Nominalflexion)~87"; $c = "\{$sep$b$sep\}"; $r = "<div>some Text $b some other text</div>"; $text =~ s/$c/$r/s;
I tried a lot of variants including quotes (?:...), and what not. Nothing worked! Is there anyone, who can stop my wasting of time with these questions? Thanks in advance! Best regards, Horst
In reply to Regex with HTML::Entities by Horst.Lohnstein
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |