Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Removing leading and trailing numbers from string

ignas
8 - Asteroid

Hey there

 

I need your help with removing leading and trailing numbers from string.

Input

45 Apple 7 bad 741, 78954, 7896

1 Banana 676 Good 987, 741 963

 
Output

 

Apple 7 bad
Banana 676 Good

Do we have any regex experts who can help me? :)

4 REPLIES 4
LordNeilLord
15 - Aurora

Hey @ignas

 

In the formula tool try this: REGEX_Replace([Field1], "(\d+\s)(\w+\s\d+\s\w+)(.*)", "$2")

jdunkerley79
ACE Emeritus
ACE Emeritus

An alternative to @LordNeilLord

REGEX_Replace([Field1], "(^[0-9 ,]+|[0-9 ,]+$)", "")

 

This just replaces numbers at start and end 

ponraj
13 - Pulsar

Here is the sample workflow for your case.  Hope this is helpful. 

 

WorkflowWorkflowResultsResults

ignas
8 - Asteroid

Hello @LordNeilLord,

 

It removes only from some of them.

Labels