Alteryx Designer Desktop Discussions

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

RegEx tool

Tomekt_
5 - Atom

Hello,

I need an advice how to approach the RegEx tool as it works in the exact opposite of what I need.

I have the column that contains control ID, but also a lot of comments which are before and after the ID. The id is always build like "CTRL-XXXXXXXXXX", where in the place of Xs there are always 10 digits.

I've used the regex generator, as I'm not that familiar with writing this by myself and I've tried both simplified one "CTRL-\b\d{9}\b" as well as the really rendundant one "CTRL-\d\d\d\d\d\d\d\d\d".
Both seemed to work as it catches the whole ID from the column, but as the output I receive everything beside the CTRL ID, so it's simply get trimmed from the value, is there any way to make it work in the opposite?

Thanks


4 REPLIES 4
binuacs
21 - Polaris

@Tomekt_ one way of doing this 

image.png

Andrew_T-H
7 - Meteor

Try this if you're using the RegEx tool:

 

CTRL ID Regex101 Screenshot.PNG

 

 

^.*(CTRL-\d{10}).*$

 

If you are selecting the Replace option in the tool then put $1 in the replace with box

Andrew_T-H
7 - Meteor

The screenshot is from a website called RegEx 101. I find it useful to test things in there instead of running workflows over and over until I get it right. 

Tomekt_
5 - Atom

Thank you both, I managed this to work with your help, also I was struggling as I wasn't aware that in the regex tool the expression needs to be in the brackets.

Labels
Top Solution Authors