Sean Girgis
asked on
Perl string tokenizing and paring
I am having a very complex string that I need to tokenize and also create name pair values when possible. Here is a sample of the strings I have
Recod Style 1
Search Result Queries;SomeHotel.com;PT\= 89030726\; PA\=-11195 67914\;PS\ =154751806 3;2017-05- 13 01:43:36.719;Search Results Query BT SPLIT=checkInDate\=5-13-20 17&checkOu tDate\=5-1 4-2017&num berOfAdult s\=1&prope rtyIds\=MS 140|MS741| MS1290|MS1 334|MS1349 |MS4557|MS 4568|MS478 3|MS4854|S S6029,Web Requests - Client IP=50.251.11.233;Execution Time Informix=2404.003662109375 ,DB Count=2.0,DB Time=2404.0037887319922;fa lse;;2424. 7604980468 75;2424.76 0498046875 ;8.6558303 53498459;2 424.760544 0989137;;; ;SomeHotel _PROD;dynt rc-mgmt.So meHotel.co m
Recod Style 2
Search Result Queries;Mobile App;PT\=89031695\;PA\=-111 9567914\;P S\=1547518 063;2017-0 5-13 01:44:17.772;Search Results Query BT SPLIT=checkInDate\=5-13-20 17&checkOu tDate\=5-1 4-2017&cor poratePlus Number\=&n umberOfAdu lts\=1&pro pertyIds\= MS1173%7CM S4961%7CMS 4376%7CMS4 281,Web Requests - Client IP=66.115.209.42;Execution Time Informix=1762.662109375,DB Count=5.0,DB Time=1759.847623437643;fal se;;1781.0 732421875; 1781.07324 21875;10.0 7407039403 9154;1781. 0732627734 542;;;;Som eHotel_PRO D;dyntrc-m gmt.SomeHo tel.com
Both record styles happen in the same file.
Main delimiter above is;
some values are name-value pairs delimited on \= or =
Some fields contain other fields and delimited by &
Any ideas on how to parse this so I can convert it to some CSV or json
Recod Style 1
Search Result Queries;SomeHotel.com;PT\=
Recod Style 2
Search Result Queries;Mobile App;PT\=89031695\;PA\=-111
Both record styles happen in the same file.
Main delimiter above is;
some values are name-value pairs delimited on \= or =
Some fields contain other fields and delimited by &
Any ideas on how to parse this so I can convert it to some CSV or json
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The author never responded to any of the answers and never provided the additional detail needed to find out exactly what they really wanted. As such, it should be closed with points split between those who supplied answers.
Where does this string of data come from? Is there any documentation for the API?