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

Alteryx Designer Desktop Discussions

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

How to extract just numbers between square brackets in string

acaryasin01
8 - Asteroid

Hi Guys,

 

I hope you all are doing well.

 

I have a data like below.

I want to extract just number between square brackets in string like Desired Column.

Desired column could be created more than one column. I mean desired column/s could include only one number (extracted from the string) 

Any help would be appreciate. 

 

My data

Desired column

[1] KCC [333]abc

1, 333

[22] www[444] abc

22, 444

[333] KCw[555][666]

333, 555, 666

[29125  Account

 

[555]absdhegaf[999]

555, 999

[11][222][333]

11, 222, 333

abc[11]aaa

11

29125] BVVV

 

 

Best regards...

7 REPLIES 7
Ben_H
11 - Bolide

Hi @acaryasin01,

 

There are various ways to do this but here's one example.

 

Ben_H_0-1642003303017.png

 

I used regex to tokenise the data on numbers in brackets.

 

Ben_H_1-1642003320965.png

Then I just concatenated it into a single field and removed the brackets with a bit more Regex.

 

Regards,

 

Ben

atcodedog05
22 - Nova
22 - Nova

Hi @acaryasin01 

 

My take on this. Similar but slightly different.

 

Workflow:

atcodedog05_0-1642003683046.png

 

Hope this helps : )

 

binuacs
21 - Polaris

@acaryasin01 

 

binuacs_0-1642006887191.png

 

 

acaryasin01
8 - Asteroid

Thank you @Ben_H it works great 👍🙏😊

 

Sorry for the late reply.

 

Best regards...

acaryasin01
8 - Asteroid

Hi @atcodedog05 Thank you as well, appreciate

It's working but my data is a bit large and more than 30 column (I would mention but forgot, sorry)

so I need to add Record Id column.

acaryasin01
8 - Asteroid

Thank you @binuacs for your effort and time 👍😊

atcodedog05
22 - Nova
22 - Nova

Hi @acaryasin01 

 

Groupby on record id too in summarize tool it should work. 

 

Anyways Happy to help : )

Cheers and have a nice day!

Labels