How to exclude spaces and parentesis on number

Hi there! :smiley: I need to do a serie of emails using the cellphone numbers that are on one excel spreadsheet which I’m using the “for each excel row” activity and the ‘type into’ one, and this is not possible since the number on the excel is mostly written on this model: ‘(XX) XXXX XXXX’ and I need it to be like ‘XXXXXXXXXX’ to do the email. How can I make the bot to delete the parentesis and the spaces between the numerbs if they are like this? best regards!

Hi @Carvalho_Vini

can you try this

inputstr.Replace(“(”,“”).Replace(“)”,“”).Replace(" “,”")
“xxxxxxx”

where do I write this?

System.Text.RegularExpressions.RegEx.Replace(“(111)222-3333”,“\D”,“”).ToString

Replace the dummy phone number with your variable, currentRow expression, etc.

You put this expression anywhere you need it. Just like any other expression. If you’re trying to make an email address to text the phone number…

System.Text.RegularExpressions.RegEx.Replace(“(111)222-3333”,“\D”,“”).ToString + “@att.net

…for example

you can
use assign activity and left create a variable and right pass the expression

System.Text.RegularExpressions.Regex.Replace(inputstr,“[()\s]”,“”).ToString
output:
“xxxxxxx”

There is no reason to create an extra variable. You can just use the expression where you need it.

Yes
As per the requirement you can use

cheers
Happy Automation

Hi @Carvalho_Vini

For Each Row activity (from your Excel DataTable)
Assign activity:
phoneNumber= row(“PhoneNumberColumn”).ToString()

Assign activity:
cleanedPhoneNumber= New String(phoneNumber.Where(Function(c) Char.IsDigit(c)).ToArray())

Type Into activity:
Element: Your email field
Text: cleanedPhoneNumber

Hey! do you have a printscreen of how it should look at the end? Best regards!

Hi it will give you the output which you mentioned in the question

Output: xxxxxxxxx

Im having this problem on saving the variable, ‘BC30451 error’. Can you help me?

But, since 'm using the ‘for each row’ it isn´t an exclusive numbeer like (xx)xxxxxxxxx. Each row has a new number.

Can you please check the varaible scope in the varaibles panel

2.it is saying that it is not accessible due to its protection level

Check the varaible which you mentioned or else create new varaible

Im using the ‘for each row’, so each row has a different number, how can I do this?

Replace the current row value in place of
Inputstr

System.Text.RegularExpressions.Regex.Replace(inputstr,“[()\s]”,“”).ToString


like this?

System.Text.RegularExpressions.Regex.Replace(inputstr,“[()\s]”,“”).ToString

No provide for which you want to make changes that value i place of inputstr

And left side place a variable to store that value

Right side place the above syntax

So you use CurrentRow(“columnname”).ToString in the RegEx expression.

[quote=“postwick, post:4, topic:572233”]
System.Text.RegularExpressions.RegEx.Replace
[/quote] an errror message is happening, 'RegEx" BC30516 is not a member from ‘System.Text.RegularExpressions’. the expression look like this: System.Text.RegularExpressions.RegEx.Replace(CurrentRow.ByField(“Telefone”)).ToString +“octachat.com

Can you
Try to import from namespace