in reply to Re: Pattern matching and deriving the data between the "(double quotes) in HTML tag
in thread Pattern matching and deriving the data between the "(double quotes) in HTML tag
Hi AnomalousMonk, Thanks for the comment. I understood that the problem was with the g - global modifier in the patters m//g. I achieved the desired output: 2016-09-30T00:00:00,2016-12-28T23:59:59 by using the below code.
#/usr/bin/perl use strict; use warnings; my $timeLimit = '<timeLimit endTime="2016-12-28T23:59:59" startTime="2 +016-09-30T00:00:00"></timeLimit>'; $timeLimit =~ m/startTime="(.*?)"/g; my $startTime = $1; chomp($timeLimit); my $endTime =''; if ($timeLimit =~ m/endTime/) { $timeLimit =~ m/endTime="(.*?)"/; $endTime = $1; } print "[$startTime],[$endTime]\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Pattern matching and deriving the data between the "(double quotes) in HTML tag
by AnomalousMonk (Archbishop) on Dec 06, 2016 at 13:32 UTC |