How to remove a specific string, anywhere

Hi everyone,
I have a problem manipulating an alphanumeric string.
When browsing a web tool, once you reach a certain point, the bot should remove, if present, the string, “Sconto 15x12”

There is a problem. (at least for me)
This string could be anywhere.
at the beginning, at the end.
it could be all uppercase or all lowercase.
and the remaining text may change.

ex:
Web business Sconto 15x12 >>>>> I need Web business
Sconto 15x12 - Web business >>>> I need Web business (or - Web business)
SCONTO 15x12 web trial >>>>>> I need web trial
Sconto 15x12 - solution phone >>>>> i need solution phone (or - solution phone)
solution phone & web SCONTO 15x12 >>>> i need solution phone & web

In the same cell, I then have to write the text, without the item “Sconto 15x12” in all its variants.
Can anyone help me in this case too?
aaron

@AaronMark ,

Where you will be storing this input string? is it in DataTable/String/Anything else

Thanks,
Ashok :slight_smile:

I’m on a WEB GUI.
I collect this data with a “get attribute” directly from the page…
and I have to replace it with the same string, without “SConto 15x12”

Basically it is a string and will remain a string.

image

If it’s easier, I can collect the entire grid as a table, though.

Hi @AaronMark

Try this:

Assign-> Input = "SCONTO 15x12 web trial >>>>>> I need web trial"

Assign-> Input = System.Text.RegularExpressions.Regex.Replace(Input,"sconto\s*15x12","",System.Text.RegularExpressions.RegexOptions.IgnoreCase)

Hope it helps!!

@AaronMark ,

Use this assign activity.

Thanks,
Ashok :slight_smile:

Hi @AaronMark

Try this in Assign Activity:

System.Text.RegularExpressions.Regex.Replace(StrInput,"sconto 15x12","",System.Text.RegularExpressions.RegexOptions.IgnoreCase).Trim

Hope it will helps you :slight_smile:
Cheers!!

Ooh!! Manesh… I have to pass you a % of my salary today!
Thanks again!
it works!

1 Like

It’s pleasure @AaronMark

If you have any queries, let me know.

Happy Automation!!

1 Like

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