Regex - Multi
I just need to parse Type, Code and description from the below message. I understand that it has to be done via parse regex. can you please clarify and give the output parse regex statement :
"[INFO]\t2020-02-04T14:10:52.188Z\t7d5fa2e6-a0d7-5b00-a900-f455dd73ff4c\t{\"level\": \"error\", \"step\": \"UoA-API-service-response-received\", \"message\": \"{\\\"dateProcessed\\\":\\\"2020-02-05T03:10:47.776+13:00\\\",\\\"applicantId\\\":547332414,\\\"externalApplicantId\\\":\\\"300008342\\\",\\\"status\\\":\\\"FAILURE\\\",\\\"applications\\\":[{\\\"externalApplicationId\\\":\\\"10\\\",\\\"programmeCode\\\":\\\"BSC\\\",\\\"campusCode\\\":\\\"\\\",\\\"termCode\\\":\\\"1203\\\",\\\"plans\\\":[\\\"CHEM-BSC\\\"],\\\"messages\\\":[]}],\\\"messages\\\":[{\\\"type\\\":\\\"INFO\\\",\\\"code\\\":\\\"INFORMATION\\\",\\\"description\\\":\\\"Processing application : external application 10.\\\"},{\\\"type\\\":\\\"INFO\\\",\\\"code\\\":\\\"INFORMATION\\\",\\\"description\\\":\\\"Validated application and structure OK.\\\"},{\\\"type\\\":\\\"INFO\\\",\\\"code\\\":\\\"INFORMATION\\\",\\\"description\\\":\\\"Completed initial validation of request.\\\"},{\\\"type\\\":\\\"INFO\\\",\\\"code\\\":\\\"INFORMATION\\\",\\\"description\\\":\\\"Found existing identity from ID.\\\"},{\\\"type\\\":\\\"WARNING\\\",\\\"code\\\":\\\"DIFFERENT_GENDER\\\",\\\"description\\\":\\\"The existing UoA applicant has a different gender in EPR.\\\"},{\\\"type\\\":\\\"INFO\\\",\\\"code\\\":\\\"INFORMATION\\\",\\\"description\\\":\\\"Validated identity.\\\"},{\\\"type\\\":\\\"INFO\\\",\\\"code\\\":\\\"INFORMATION\\\",\\\"description\\\":\\\"Already got disability.\\\"},{\\\"type\\\":\\\"INFO\\\",\\\"code\\\":\\\"INFORMATION\\\",\\\"description\\\":\\\"Already got phone.\\\"},{\\\"type\\\":\\\"INFO\\\",\\\"code\\\":\\\"INFORMATION\\\",\\\"description\\\":\\\"Completed processing identity.\\\"},{\\\"type\\\":\\\"INFO\\\",\\\"code\\\":\\\"INFORMATION\\\",\\\"description\\\":\\\"Found existing applicant.\\\"},{\\\"type\\\":\\\"INFO\\\",\\\"code\\\":\\\"INFORMATION\\\",\\\"description\\\":\\\"Updated applicant details.\\\"},{\\\"type\\\":\\\"INFO\\\",\\\"code\\\":\\\"INFORMATION\\\",\\\"description\\\":\\\"Already got qualification 'TERTIARY' from 'test'.\\\"},{\\\"type\\\":\\\"INFO\\\",\\\"code\\\":\\\"INFORMATION\\\",\\\"description\\\":\\\"Already got English Language Test 'IELTS Academic' from ''.\\\"},{\\\"type\\\":\\\"INFO\\\",\\\"code\\\":\\\"INFORMATION\\\",\\\"description\\\":\\\"Updated applicant history.\\\"},{\\\"type\\\":\\\"INFO\\\",\\\"code\\\":\\\"INFORMATION\\\",\\\"description\\\":\\\"Completed processing applicant.\\\"},{\\\"type\\\":\\\"ERROR\\\",\\\"code\\\":\\\"APPLICATION_ALREADY_EXISTS\\\",\\\"description\\\":\\\"ExternalApplicationID 10 : SDJ Application already exists for that applicant, programme, plan and term as 310158.\\\"},{\\\"type\\\":\\\"ERROR\\\",\\\"code\\\":\\\"APPLICATION_ALREADY_EXISTS\\\",\\\"description\\\":\\\"ExternalApplicationID 10 : CS9 Application already exists for that applicant, programme, plan and term as 01410021.\\\"},{\\\"type\\\":\\\"ERROR\\\",\\\"code\\\":\\\"ORCHESTRATION_FAILED\\\",\\\"description\\\":\\\"Orchestration failed with issues for external application 10.\\\"},{\\\"type\\\":\\\"ERROR\\\",\\\"code\\\":\\\"INVALID_APPLICATION\\\",\\\"description\\\":\\\"The application already exists.\\\"}]}\", \"function\": \"dev-uoa-application-submission-v1\", \"caller\": \"arn:aws:lambda:eu-central-1:527801330826:function:dev-uoa-application-submission-v1\", \"action\": \"Opportunity.Root.Updated\", \"event-time\": \"2020-02-04T14:09:38Z\", \"root-entity-id\": \"00163E6CB8FE1EDA91E8179E58160F58\", \"entity-internal-id\": \"300008342\", \"correlation-id\": \"00163e6c-b8fe-1eea-91ea-ff91aee800d5\", \"event-entity-id\": \"00163E6CB8FE1EDA91E8179E58160F58\", \"message-id\": \"\", \"entity-name\": \"UoA\", \"source\": \"c4c\", \"error\": \"\", \"submission-method\": \"IDP Direct\", \"instituition-code\": \"\", \"instituition-crm-id\": \"0050002146\", \"application-status\": \"Z02\"}"
-
try this:
| parse regex field=some_field "type\\{3}\":\\{3}\"(?<type>[^\\]+)\\{3}\",\\{3}\"code\\{3}\":\\{3}\"(?<code>[^\\]+)\\{3}\",\\{3}\"description\\{3}\":\\{3}\"(?<description>[^\\]+)" multi nodrop
this would work if you had a 'less escaped' version !
| parse regex field=some_field "type\\{1}\":\\{1}\"(?<type>[^\\]+)\\{1}\",\\{1}\"code\\{1}\":\\{1}\"(?<code>[^\\]+)\\{1}\",\\{1}\"description\\{1}\":\\{1}\"(?<description>[^\\]+)" multi nodrop
Please sign in to leave a comment.
Comments
1 comment