Extract string from text


#1

Hi,
Below is my string and need to extract only Bold string, this string may differ. How to extract that particular sting?

Integration Platform Alert Triggered in Production P3
Event Code: ErrorReported Error Count: 1
Triggered: 2018-07-17T19:42:24.397Z
Description: Integration error(s) reported in the last 15 minutes. Error details can be viewed in Kibana http://asos.do/8BGga3.

Action: See the runbooks for specific error codes for steps to remediate: https://asoscom.atlassian.net/wiki/spaces/DT/pages/360678337/FR+-+Runbook+Scenarios & https://asoscom.atlassian.net/wiki/spaces/MIP/pages/58262331/Runbook.

Summary
Environment Flow ID Event Type Event Code Count
as-mule-prod-sct-esb-0
↳ WAH-RETPT-PTS
↳ ↳ ERROR - Unable to process Rebound Response
↳ ↳ ↳ ASOS_SCT_TrackAndTrace_PtsFeeds_Stage1_Rebound_Message_ProcessingFailed


#2

I doubt whether you can extract a string based on the font, you need to have some reference like starting position or line or some tag etc… you can use string functions like search, contains, substring etc…


#3

I have given font as for example only , need to ASOS_SCT_TrackAndTrace_PtsFeeds_Stage1_Rebound_Message_ProcessingFailed.


#4

Can you search for “ProcessingFailed” word ? Is that key word consistent ?


#5

Hi @NagaSujitha

Is the text always preceded by three arrows? If yes, you could use this regex:
(?<=↳\t↳\t↳ ).+

The code that will give you the output string to assign is this:
System.Text.RegularExpressions.Regex.Match(inputString,"(?<=↳\t↳\t↳ ).+").ToString


#6

No the issue is, the extracted value may change so need to extract with position.

Some how i got it like result as

Product Code = ? ? ? ASOS_SCT_TrackAndTrace_PtsFeeds_Stage1_Rebound_Message_ProcessingFailed 1

now just need to extract ASOS_SCT_TrackAndTrace_PtsFeeds_Stage1_Rebound_Message_ProcessingFailed


#7

I tried but getting empty result


#8

I forgot that the forum will sanitize the tab character :slight_smile:

I edited my previous post to display the correct solution.
Also see here for an example workflow with two separate solutions included (.Split string method and Regex)
SplitString.zip (1.9 KB)


#9

Thanks Its worked


#10