argos has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to pull out the url value found in the REDIRECTURL element of this XML Here is what works so far. This seems to work but maybe there is a better way?
#!/usr/bin/perl use warnings; use strict; my $data; $data = <<XML; <PHC_LOGIN>\r <VERSION>3.0</VERSION>\r <PARTNERID>8747</PARTNERID>\r <USERLOGIN>john.doe.</USERLOGIN>\r <ERROR_CODE>0</ERROR_CODE>\r <ERROR_DESCRIPTION>Login Successful</ERROR_DESCRIPTION>\r <SESSIONID>c12168e0-e34e-4c27-b4a6-be235ff7fa41</SESSIONID>\r <REDIRECTURL>https://example.com/_bers/log.asp?SID=c12168e0-e34e-4c2 +7-b4a6-be235ff7fa41</REDIRECTURL>\r </PHC_LOGIN> XML if ($data =~ /(https:\/\/[^\s]+[$<])/ ) { print "Found: $1\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: regex pattern matches
by Anonymous Monk on Aug 22, 2014 at 12:29 UTC | |
by jellisii2 (Hermit) on Aug 22, 2014 at 14:57 UTC | |
|
Re: regex pattern matches
by vinoth.ree (Monsignor) on Aug 22, 2014 at 12:16 UTC | |
by johngg (Canon) on Aug 22, 2014 at 12:48 UTC | |
by Laurent_R (Canon) on Aug 22, 2014 at 18:48 UTC | |
by argos (Initiate) on Aug 22, 2014 at 12:32 UTC | |
|
Re: regex pattern matches
by roboticus (Chancellor) on Aug 22, 2014 at 12:19 UTC |