http://www.perlmonks.org?node_id=979650


in reply to get string between two < tags > in .js file (xml)

You need m%%, the regular expression search operator instead of s%%%, the regular expression substitute operator. The code below should give you a start, more you can find out in the perl documentation perlre

my ($result)= m%</Name><Symbol>([^<]*)</Symbol>%;

Replies are listed 'Best First'.
Re^2: get string between two < tags > in .js file (xml)
by kamchez (Initiate) on Jul 03, 2012 at 12:19 UTC

    great ! thanks a lot this is what I've got :

    use strict; use warnings; use File::Basename; use Text::ParseWords; if ($#ARGV == 0) { open my $file, "<", $ARGV[0] or die "Couldn't open file '$ARGV +[0]': $! \nDid you specify a valid file?"; while (<$file>) { if ($_ =~ m%</Name><Symbol>([^<]+)%) { my $SYMBOL; $SYMBOL = $1; print "NEWCOLUMN:\"$SYMBOL\"\n"; } } }

    Next part ... print all matches and insert them into each field