Several replaces into one string

Hi guys. Do you know how to replace different words into one string?

Example:

I have this string with mixed numbers and strings: “N1u2m3b4e5r”

I want to take out the numbers in one variable and letters in other variable to ger de results “12345” and “Number”

I was thinking to make this:
variableLetters.Replace(“1”,"").Replace(“2”,"").Replace(“3”,"").Replace(“4”,"").Replace(“5”,"")
BUT IS FREAKING LONG

There is a way to resumen this into a simple sentence?

thank you for your time

Hi @KevinDS

You can do it with the help of regex expression

with matches activity

Thanks
Ashwin S

Well, basically you can create an Dictionary (in Excel for example). Then you can check values in the loop with all Keys from the dictionary

ThankYou @pllo2ptk For now I’ve made something like this. I’ve put every number into an array and put the assign into a forEach.

@AshwinS2 I’ve tried this. But my problem in the real case is that I have one name and one date in 2 columns:

John Miller 03-03-19

The first column is very small and when I’ve read the line I get this:

John Mil0le3r-03-19

In this case I don’t know how to use matches to take just the date or just the name. So For now i’m using this array To erase any letter to have the name and later the same array to have the date:

ForEach Letter = {“A”,“B”,“C”,“D”,“E”,“F”,“G”,“H”,“I”,“J”,“K”,“L”,“M”,“N”,“Ñ”,“O”,“P”,“Q”,“R”,“S”,“T”,“U”,“V”,“W”,“X”,“Y”,“Z”}

variable.Replace(Letter,"")

Hi @KevinDS

hey you can do one thing while finding the regex with numbers \d{2}-\d{2}-\d{2} like this values you will get so based on that you can loop the data and strarray.replace(item,"")

like this you can do

Thanks
Ashwin S

1 Like

@KevinDS How are you reading the Value John Miller 03-03-19, Is it from an Excel File?

1 Like

Hi @supermanPunch Is from a PDF file with a simple read PDF text because the PDF is a digital one

@KevinDS Have you set the value to True in Preserve Formatting Property of Read PDF Text and Checked if the Value you want to Extract is in a Proper Format?

1 Like

Check this workflow,
Test.xaml (8.7 KB)

1 Like