SAP-Fiori

Hello all This is the text i have

Error Message Bar Parked document 1710 DSD does not exist
Parked document 1710 DSD does not exist

But i need Error and Parked document 1710 DSD separately.

Thank you.

Hi @happyfeat87 are you want to extract Error and Parked document 1710 DSD from the above text?

1 Like

HI @happyfeat87

Try with this Regex Expression

System.Text.RegularExpressions.Regex.Match(YourString,"(Err)\S.*(?=\sdoes)").Tostring

1 Like

Hi @happyfeat87

System.Text.RegularExpressions.Regex.Match(YourString,"^Error").Tostring

Output -> Error

image

1 Like

HI @happyfeat87

System.Text.RegularExpressions.Regex.Match(YourString,"(?<=Message\sBar\s)(\S.*)(?=\sdoes)").Tostring

Output -> Parked document 1710 DSD

image

Regards
Gokul

1 Like

HI @happyfeat87

Checkout this expression

System.Text.RegularExpressions.Regex.Match(str,"(?<=Error Message Bar\s).*(?=\sdoes)").tostring


image

if you want to separate the lines try this

For first line

System.Text.RegularExpressions.Regex.Split(str,"\n")(0)

For second line

System.Text.RegularExpressions.Regex.Split(str,"\n")(1)

Regards
Sudharsan

1 Like

Yes.
And in future it could be like

Success Message Bar Parked document XXXX is success
Parked document XXXX success

Hi @happyfeat87

System.Text.RegularExpressions.Regex.Match(YourString,"^Error|^Success").Tostring

image

Regards
Gokul

1 Like

HI @happyfeat87

System.Text.RegularExpressions.Regex.Match(YourString,"(?<=Message\sBar\s)(\S.+)(?=\sis|\sdoes)").Tostring

image

1 Like

Thank you.
But the challenge is that text would be changing dynamically.
For example.
In future It could be
Success Message Bar Parked document XXXX is success
Parked document XXXX success

But the position of the words Message Bar will be same.

Check out this expression @happyfeat87

1 Like

@happyfeat87 Okay use these regex pattern

  1. (?:^error|success)
  2. (?:parked\sdocument\s\d*\sdsd)

(?:parked\sdocument\s\d*\sdsd)|(?:^error|success)

@happyfeat87

Checkout this for your status success or error

Split(System.Text.RegularExpressions.Regex.Split(str,"\n")(0)," ")(0)

image
image

For parked document

System.Text.RegularExpressions.Regex.Match(str,"(?<=Bar\s)Parked document.*(?=\sis|\sdoes)").tostring



1 Like

Thank you for your response.

I tried both the expressions.
1st one works fine.
But the second expression is not giving expected result.

What is Input for the Second method? @happyfeat87

Can you share with us?

Thanks for the response.

System.Text.RegularExpressions.Regex.Match(str,"(?<=Bar\s)**Parked documen**t.*(?=\sis|\sdoes)").tostring

But text in bold will be changing.

Try this @happyfeat87

1 Like

Perfect!!

Thanks.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.