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.
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?
HI @happyfeat87
Try with this Regex Expression
System.Text.RegularExpressions.Regex.Match(YourString,"(Err)\S.*(?=\sdoes)").Tostring
Hi @happyfeat87
System.Text.RegularExpressions.Regex.Match(YourString,"^Error").Tostring
Output -> Error
HI @happyfeat87
System.Text.RegularExpressions.Regex.Match(YourString,"(?<=Message\sBar\s)(\S.*)(?=\sdoes)").Tostring
Output -> Parked document 1710 DSD
Regards
Gokul
HI @happyfeat87
Checkout this expression
System.Text.RegularExpressions.Regex.Match(str,"(?<=Error Message Bar\s).*(?=\sdoes)").tostring
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
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
Regards
Gokul
HI @happyfeat87
System.Text.RegularExpressions.Regex.Match(YourString,"(?<=Message\sBar\s)(\S.+)(?=\sis|\sdoes)").Tostring
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
@happyfeat87 Okay use these regex pattern
(?:parked\sdocument\s\d*\sdsd)|(?:^error|success)
Checkout this for your status success or error
Split(System.Text.RegularExpressions.Regex.Split(str,"\n")(0)," ")(0)
For parked document
System.Text.RegularExpressions.Regex.Match(str,"(?<=Bar\s)Parked document.*(?=\sis|\sdoes)").tostring
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.
System.Text.RegularExpressions.Regex.Split(str,"\n")(1)
Try this @happyfeat87
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.