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

Alteryx Designer Desktop Discussions

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

Extracting multiple numbers from string and put them into a new column

Dag2
5 - Atom

Hello,

I have String data that looks like this:

"The user with id '52733' has started the attempt with id '4570814' for the quiz with course module id '2103511'."

 

I would need to extract all numbers in this string and put them into separate columns (one column for each number).

Is there a way to do this a bit more flexible then with the TextToColumns Feature?

Because the text is varying in length and sometimes includes only two IDs and sometimes four.

I tried REGEX_Match but I could only get it to give me the first number.

 

Help would be much appreciated!

Thank you in advance.

 

Best regards,

 

3 REPLIES 3
cjaneczko
13 - Pulsar

Does every string field contain 3 sets of numbers or are there instances where there are less/more?

 

Edit: Nevermind I didnt fully read your problem. I do see now that you have more or less than 3 number strings.

 

cjaneczko
13 - Pulsar

This is one way to do it so each ID is in a column.

 

 

 

(?:^|\D)(\d+)(?:$|\D)

 

 

image.png

image.pngimage.png

 

 

Dag2
5 - Atom

That was such an elegant solution, thanks!

Labels
Top Solution Authors