Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

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