Need to remaove some strings from entence

Hi,

I have the sentence as below:
Error Message Bar No hits were found for storage location 1002 in plant 1110No hits were found for storage location 1002 in plant 1110View Details

I want to make it as below:
No hits were found for storage location 1002 in plant 1110No hits were found for storage location 1002 in plant 1110

I want to remove"Error Message Bar " and “View Details”

Hi @shruthi_arali

Try this You’ll get the result as expected
original_sentence = “Error Message Bar No hits were found for storage location 1002 in plant 1110No hits were found for storage location 1002 in plant 1110View Details”

result_sentence = original_sentence.replace("Error Message Bar ", “”).replace(“View Details”, “”)

print(result_sentence)

1 Like

Hi @shruthi_arali

There are a few options here. Firstly you can try regular expressions (regex). Try websites like regex101 to help figure out what that regular expression is, and you can use the activity “IsMatch” within your workflow.

Otherwise if you can guarantee you are always removing exactly “Error Message Bar” from the beginning and “View Details” from the end, you could use Substring or Trim to manually format the string.

Please try these methods and see what works best for you.

1 Like

Hi,

How about the following expression?

System.Text.RegularExpressions.Regex.Replace(yourString,"Error Message Bar |View Details","")

Regards,

2 Likes

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