Remove digits only from a string

Hi All,

I am getting some string variables as “ABC DEF GHI 95636705” or “ABC DEF GHI3469234”. A word that that contains only digits or last word contains string and digits as well.

Can anyone advise me how, to remove the digits only from the last word of the string like this?

1 Like

You can try to remove the last char like string.trimEnd

@satyajit.samanta Follow Below solution

         Assign str =  “ABC DEF GHI 95636705” 

         Assign str  = System.Text.RegularExpressions.Regex.Replace(str ,"\d", " ")

Now str will have the result ABC DEF GHI

Hope this helps you.


Assign str = System.Text.RegularExpressions.Regex.Replace(str ,"\d", " ").Trim

I would add Trim to end of your statemnt just to remove unwanted spaces.

Hi @satyajit.samanta,
Welcome back to Forum…
I prepared a workflow for your case, once see the file .I hope it helps you.

File:removeDigits.xaml (4.9 KB)
If you find it useful mark it as solution and close the thread.
If any queries ping me:grinning:

1 Like