Remove text inside parentheses

i want to remove the text inside parentheses.
eg.-591 in Grocery & Gourmet Foods (See Top 100 in Grocery & Gourmet Foods)
i want to remove the text inside parentheses.
my expected Result will be-591 in Grocery & Gourmet Foods.
how can i do this?

Hi,

We can achieve it using Replace activity as the following settings.

Input: your string variable
Pattern: "\(.*\)"
Replacement: ""
Result : result string variable

Regards,

1 Like

Use this below code, @arijit1213
StringVar = System.Text.RegularExpressions.Regex.Matches(YourInputString,“.*(?=()”)(0).ToString .

It might be safer to use a lazy quantifier to avoid problems if more than a pair of parentheses. I didn’t push to see how to handl also parentheses in parentheses[1])

Pattern: "\(.*?\)"

[1] EDIT: actually you might want to loop and compare the result with the result after substitution (in pseudo-code with a While but you could use a DoWhile)

Current = MyString
Result = ""

While Current <> Result:
    Current = Result
    Result = ...substitution

i got an error after doing this.

Check this workflow, @arijit1213
TestSequence.xaml (15.7 KB)
I have putted it in the message box , you can change it to assign activity and save in a variable.

thank u…it works

Happy Automation :smiley: :+1: @arijit1213

i want to remove some portion of this text.how can i do it.
eg-Reviewed in India on 8 January 2018.
my reasult would be 8 January 2018.(date, month, year changeble every time)

Use this below code, @arijit1213
System.Text.RegularExpressions.Regex.Matches(“Reviewed in India on 8 January 2018”,“\d+\s[A-z\s]+\d{4}”)(0).ToString

i did it using replace

i want to pick comments of a product of amazon.i done data scraping for all comments using data scraping with next page. But now some comments are stored. in data base.now i want to pick only new comments(which are not present in database.)
how can i do this?

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