I have the following string (its a comment box):
I need to retrieve the first message after the date and time and ending with the dashed line ----------.
Can anyone guide on how to split it.
Thanks.
I have the following string (its a comment box):
I need to retrieve the first message after the date and time and ending with the dashed line ----------.
Can anyone guide on how to split it.
Thanks.
You can use the Split command for doing this. ErrorMsg is the variable holding this message.
Split(ErrorMsg,“–”)[0]
@chauhan.rachita30 Try using regex
Encountered the following exception.*[\n\r]+.*
@chauhan.rachita30 Use the below one, it would work. Check the attached workflow
Example.zip (3.0 KB)
Variable of type string Output = System.Text.RegularExpressions.Regex.Match(Input, "Encountered\s+the\s+following\s+exception.*[\n\r]+.*").ToString
Input
Output
Hey @chauhan.rachita30,
Thanks,
Sanjit
the small Pattern:
Encountered[\s\S]*?(?=\-{3,})
It can start with anything, not specifically “Encountered”. Thanks
It can start with anything, not specifically “Encountered”. Thanks
just share with us some more patterns with the variations. Thanks
It can be any message, I just need the first message after the date and before the dashed line.
better with samples, but you can try following quick shot:
refering to group 1
strPattern = (?:[\d\/\: APM]+)([\s\S]*?)(?=\-{3,})
strResult =
System.Text.RegularExpressions.Regex.Match(yourTextVar, strPattern).Groups(1).Value
Thanks a ton!!!
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.