Thread Regex Problem
(4 answers)
Opened by crojay at 2011-09-15 16:25
Hi,
folgendes tut bei mir: Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 use strict; use warnings; use File::Slurp; my $searchStr = "value=\".*\""; my $suffix = "YEPPA"; my $replaceStr = "value=\"_" . $suffix . "\""; my @lines = read_file( \*DATA ); foreach my $line(@lines){ print "line --> $line"; $line =~ s/$searchStr/$replaceStr/g; print "line --> $line"; } __DATA__ <?xml version="1.0" encoding="utf-8" ?> <configuration> <appSettings> <add key="ServiceId.suffix" value="_TEST" /> </appSettings> </configuration> Ergibt folgenden output: Code: (dl
)
1 E:\develop>perl test.pl Grüße, Michael |