in reply to Cannot get Perl to replace a specific string in my textfile
Hi haukex,
you are right it was a typo.
Thank you very much for your insights regarding the word boundaries and also those on literally matching, did not take it into account so far.
I changed both in my code and now it works as intended, I do not yet fully understand to build a regex dynamically though. But i do understand the possiblity to write more elegant code
so finally still with repetition and static ;-)
if ( m/:Calendar(?=\/)/ or m/:Contacts(?=\/)/ or m/(?<=\"\/)Users/ or m/.+@.+\"\s=/ or m/_A_domain_D_com/ ) { foreach my $key ( sort keys %replacements ) { s/\Q$key\E/$replacements{$key}/g; } }
Indeed that helped Hauke, thanks!
Sascha
|
|---|