in reply to Re^3: regex replace a string (updated)
in thread regex replace a string
Thank you for your help Anomalous Monk, I have applied the substitions you proposed and every thing works fine
use strict; use warnings; my $text = do { local $/; <>; }; my %replacement = ( 'b' =>' Schwarz am Zug', 'w' => 'Weiß am Zug', ); ;; my $condition = qr{ \b (?: b | w) \b }xms; $text =~ s{ Event \s+ " \K [?] (?= " .*? FEN [^\n]* \s+ ($condition) \s+ -) } {$replacement{$1}}xmsg; print $text;
|
|---|