In case you missed the announcement: The Alteryx One Fall Release is here! Learn more about the new features and capabilities here
ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests after December 31, 2025. Set up your security questions now so you can recover your account anytime, just log out and back in to get started. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

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

REGEX: Add "-" after a specific number of digits

BautistaC888
8 - Asteroid

Hello,

I need to add a "-" at the first 2 digits and after the following 8 digits.

BautistaC888_0-1623358503688.png

Thank you.

2 REPLIES 2
mpennington
11 - Bolide

Assuming the length of your string stays consistent, this should work:

REGEX_Replace(ToString([INPUT]),'(\d{2})(\d{8})(\d{1})','$1-$2-$3')

Replace.png 

cplewis90
13 - Pulsar
13 - Pulsar

Hey @BautistaC888,

 

As long as the string length of the input column stays the same you should be able to use this formula in a standard formula tool:
left(ToString([INPUT]),2)+"-"+Right(Left(tostring([INPUT]), 10), 8)+"-"+Right(ToString([INPUT]), 1)

Labels
Top Solution Authors