Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I'm basically trying to capture:
1. The ticket number: (for example, ACCOUNT-09782)
2. The CreatedDate field and value mentioned in the Remedy Case Data section (not the Remedy Account data section that appears earlier in the record).
3. The ClosedDate field and value mentioned in the Remedy Case Data section
I was thinking something along the lines of :
Any tips much appreciated!$/ = "\n\n"; while (<DATA>) { chomp; my $line = $_; $line =~/(ACCOUNT-\d{5}).*Remedy Case data.*(ClosedDate.*)\\.*(Created +Date.*)\\/; my $account = $1; my $closed = $2; my $created = $3; . . . }
__DATA__ ACCOUNT-09782 comment \ Remedy Account data: \ IsDeleted = No\ Name = Singtel PMC\ Type = Existing Account\ Industry = Network Operator\ OwnerId = Foo Foobar (foo@whatever.com)\ CreatedDate = 2007-02-21 23:59:56\ \ Remedy Account Contact Role data: \ None found\ \ Remedy Case data: \ CaseNumber = 00013383\ ContactId = Sharon Tesla\ AccountId = Blah blah\ Type = Problem\ Status = Closed\ Reason = User create/change/delete from system\ IsVisibleInSelfService = 1\ Subject = Setup Login Credentials / Lando Franklin\ Priority = Medium\ Description = Please set up Lando Franklin with login credentials. Yo +u may mirror my profile. Her email address is 2326265@whatever.com. + Thank\ you!!!\ IsClosed = 1\ ClosedDate = 2007-10-26 16:31:53\ Actual Work Time = 1.00\ CreatedDate = 2007-10-23 21:10:10\ CreatedById = 00500000006onM1AAI\ Environment__c = Production\
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: using regex with records
by JavaFan (Canon) on Jan 02, 2012 at 01:39 UTC | |
|
Re: using regex with records
by Cristoforo (Curate) on Jan 02, 2012 at 02:09 UTC | |
|
Re: using regex with records
by toolic (Bishop) on Jan 02, 2012 at 01:14 UTC | |
by Anonymous Monk on Jan 02, 2012 at 01:24 UTC | |
by toolic (Bishop) on Jan 02, 2012 at 01:57 UTC |