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: Last four numbers after last comma

carlcmat
6 - Meteoroid

Gatejalla 1, 0355 Oslo

Gatejalla 1, 5645, 0215 Oslo

Gatejalla 1, asdasd, 0545 Oslo

 

I need an Regex expression where it parse the last four numbers AFTER THE LAST COMMA in a string.

 

7 REPLIES 7
MarqueeCrew
20 - Arcturus
20 - Arcturus
Regex_Replace([Field],".*?,(\d{4}).8",'$1')

That's the droid that you're looking for.

 

Cheers,

 

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
carlcmat
6 - Meteoroid

It didnt work for me. Can you see the attached image and please upload the solution? :)

 

Skjermbilde.PNG

MarqueeCrew
20 - Arcturus
20 - Arcturus

That's a different pattern!

 

Regex_Replace([Original field],".*,.*(\d{4}).8",'$1')

becomes:

 

Regex_Replace([Original Field],".*?,.*(\d{4}).*",'$1')

 Cheers,

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
carlcmat
6 - Meteoroid

Skjermbilde2.PNG

 

No, not really.

 

1) It shall parse ONLY four numbers which stands alone

2) It shall parse ONLY those four numbers AFTER THE LAST COMMA in the string

 

 

ponraj
13 - Pulsar

Here is the sample workflow for your case.  Hope this is helpful. 

 

WorkflowWorkflowResultsResults

danrh
13 - Pulsar

Give this a shot:

 

image.png

ponraj
13 - Pulsar

Possible to share the sample data in text format ? 

Labels