Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Community is experiencing an influx of spam. As we work toward a solution, please use the 'Notify Moderator' option on the ellipsis menu to flag inappropriate posts.

Alteryx Designer Desktop Discussions

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

Regex to extract string between different delimiters (Tokenize)

fredcolina
7 - Meteor

Hi,

 

I have a log with a field that I would like to Tokenize. I would like a Regex that will split the string in different tokens based on three delimiters that I could have (until now :-))

 

Basically bring into columns all the string between:

 

>

|

,

 

 

Example.PNG

 

 

6 REPLIES 6
MarqueeCrew
20 - Arcturus
20 - Arcturus
Did you know that you can use the text to columns tool and put all three delimiters into the delimiter field? That seems like the easy answer.

Cheers,

Mark
Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
fredcolina
7 - Meteor

Hi, thanks for your quick reply.

 

The issue with that path is that I will need to create as many steps in the flows as delimiters no?

 

I was wondering if I can group a Regex in which I can give the strings (delimiters) to consider and then grab the string after that.

 

Freddy

fredcolina
7 - Meteor

Nevermind, I didn't realize that I can have multiple delimiter within the tool!

 

Thanks for your help

 

Capture.PNG

sakshim
8 - Asteroid

I have a same problem but I want to use this in Formula tool, hence don't wish to create multiple columns just extract the string, I have a substring which is like  '"ACTO": IMPID-452673";" at any place in the sentence. I just need to extract IMPID-452673 (Kindly note the length of numbers can be more or less ). In every sentence, IMPID is followed by ";"  

sakshim
8 - Asteroid

Regex would be highly appreciated as I want to understand Regex function more in detail

 

dwstada
11 - Bolide

 Hey @sakshim 

 

sakshim.PNG

 

try this out, it looks for the IMPID and replaces everything in the cell with the found IMPID.

 

regex parts:

.*? = content can start with anything for as long as necessary

(IMPID-\d+) = find "IMPID-" and any number of digits afterwards, and remember the found string in a capture group

.* = anything can come afterwards

 

with the regex_replace function, we replace whatever matched the expression with what we specify, and this replaces everything with "$1" which is the first capture group of the expression

Labels