Separar numeros de letras

Hola comunidad, solicito su ayuda con lo siguiente.
tengo una tabla de datos en excel con una columna de nombre pedidos, los pedidos vienen numéricos y alfanuméricos. La situación es que necesito que solo sean números así:
1234 estaría bien
12wse34-oc-1 debería ser 12341
SUM-3456 debería ser 3456
OC5873 debería ser 5873
9867OC debería ser 9867
y así varios casos más. Traté con Regex, pero no me funcionó.

Gracias por su ayuda.

Hi @camilo_gonzalez ,

If you are already using a For Each Row Activity to update the values in the datatable. Then, in the Assign Activity for Updating the Column use the below Expression :

row("orders") = String.Join("",row("orders").ToString.Where(Function(x)x.ToString.IsNumeric).ToArray)

Let us know if it doesn’t work.

1 Like

Hola @supermanPunch, muchas gracias por tomarse el tiempo de responder, traté de hacerlo pero no me funciona.

el asistente de UiPath pedía cambiar el igual que está antes del string.join por un IS, pero ni así funciona.

muchas gracias

@camilo_gonzalez

Can you please try this

Currentrow("Orders") = System.Text.RegularExpressions.Regex.Replace(currentrow("Orders").ToString,"[^0-9]","")

Hope this helps…if you get any error please let us know so that we can correct if needed

Cheers

1 Like

@camilo_gonzalez ,

Just use the R.HS. of the Expression i.e the Expression below when entering the value for Assign Activity :

String.Join("",row("orders").ToString.Where(Function(x)x.ToString.IsNumeric).ToArray)
1 Like

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