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";
In reply to regex pattern matches by argos
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |