Support Portal

for ProcessRobot and WinAutomation

Start a new topic
Answered

remove text with parentheses

Hi Team,


I have batch of data in excel, wording with parentheses. How can we remove the text inside parentheses in one time?

xlsx

Best Answer

Hi Michelle,


In order to remove the text within the parentheses you can do this easily using UI actions and Send Keys. 

For instance, you could Focus the Excel Window (Focus Window action), Send the CTRL+H key combination (Send keys action) in order to open the Replace Window, Populate Text with (*), and Click the Replace all button Element in Window  as below:



Alternatively, you could read the Excel contents, and loop each row using a regular expression similar to this: (?<=[a-zA-z])(\s\(.*\)) and replace it with the empty string using %""%. Afterwards, you can overwrite the replaced text on top of the existing Excel cells. This way requires more actions and may more time to run compared to the first option.




ADMIN
Answer

Hi Michelle,


In order to remove the text within the parentheses you can do this easily using UI actions and Send Keys. 

For instance, you could Focus the Excel Window (Focus Window action), Send the CTRL+H key combination (Send keys action) in order to open the Replace Window, Populate Text with (*), and Click the Replace all button Element in Window  as below:



Alternatively, you could read the Excel contents, and loop each row using a regular expression similar to this: (?<=[a-zA-z])(\s\(.*\)) and replace it with the empty string using %""%. Afterwards, you can overwrite the replaced text on top of the existing Excel cells. This way requires more actions and may more time to run compared to the first option.



Hi,


I tried the excel method, but it isn't working and error at %ExcelData[index][0]% , Please advise..

photo10.png
(145 KB)
ADMIN

Try Clicking on the error tab to view what the exact error is. From your screenshot it appears that you have specified a %LoopIndex% variable instead of  %index%. It should now work.

Hi, I tried to change as well, no result after execution. do you mind your process?

photo11.png
(155 KB)
ADMIN

In the Loop Action the variable is %Index% instead of %index% could you try replacing it?

Replaced %Index%, not working fine also...

photo15.png
(150 KB)
ADMIN

Have you enabled the Use Regular Expressions for find option checked? This needs to be checked when using regular expressions.


Alright, now got it!

Thanks!

ADMIN

You are welcome Michelle!

Login or Signup to post a comment