Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Regex replace only the 1st character

terrellchong
8 - Asteroid

Hi, let say I have a value that is like this

-112324-A

 

How do I use Regex replace to make the result look like this?

112324-A

Thanks in advance

4 REPLIES 4
atcodedog05
22 - Nova
22 - Nova

Hi @terrellchong 

 

Regex formula would be

 

 

REGEX_Replace([Field1], ".(.*)", "$1")

 

 

Workflow:

atcodedog05_0-1642409873641.png

 

Hope this helps : )

atcodedog05
22 - Nova
22 - Nova

Hi @terrellchong 

 

You can also do it without regex. The below method might give better performance.

 

Workflow:

atcodedog05_0-1642410007416.png

 

Hope this helps : )

 

OllieClarke
15 - Aurora
15 - Aurora

Hi @terrellchong just adding other options to the two which @atcodedog05 has given, but you can use the substring function here as well

 

Substring([field],1)

 

 

OllieClarke_0-1642416859465.png

 

edit: I did a performance comparison of the 3 methods, and I would avoid using RegEx here, but there isn't much between using Substring() and Right()

OllieClarke_0-1642417126080.png

 

 

atcodedog05
22 - Nova
22 - Nova

@OllieClarke 

 

yup, I keep tending to forget Substring() function should start using it more 😅

 

Labels