g_speran has asked for the wisdom of the Perl Monks concerning the following question:
Wondering if someone can put eyes on this and tell me what i am doing incorrectly. I've tried several option but make it worse
Hoping someone can quickly spot my error.
i need to get rid of the doublequotes after 'value=' and before '/>'
Thanks in advance
my $content = '<entry key="maxcompdatastripe" value="41943040" />'; my $maxreplacement_value = ' "20917520" merge="keep" '; $content =~ s/(<entry key="maxcompdatastripe" value=")[^"]*("\s*\/>)/$ +1$maxreplacement_value$2/g; print "Content: $content\n"; Expected results: <entry key="maxcompdatastripe" value="20917520" merge="keep" /> Actual Results: Content: <entry key="maxcompdatastripe" value=" "20917520" merge="keep +" " />
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Regular Expression Assistance
by choroba (Cardinal) on Jun 19, 2024 at 18:11 UTC | |
Re: Regular Expression Assistance
by jdporter (Paladin) on Jun 19, 2024 at 16:49 UTC | |
Re: Regular Expression Assistance
by g_speran (Scribe) on Jun 19, 2024 at 17:07 UTC |