Alteryx Designer Desktop Discussions

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

REGEX

DoneF
6 - Meteoroid

Hi, I'm fairly new to Alteryx and have inherited some REGEX code that is not working quite how I need it to. Within a string I'm looking for an IBAN code which always starts with 2 letters (representing a country) and then depending on the country this may be followed by 2 number 4 letters 17 number or any sort of combination of letters and numbers. The REGEX that I have successfully finds the IBAN when it is at the start of the string, which contain pipe de-limiters, but not in  the middle of a string.

For example, in this string  |DE9999991112222333344|ANYWHERE, ANY|ANYROAD|ANYTOWN the regex will identify the IBAN DE9999991112222333344

but not in this string ABC LIMITED|DE9999991112222333344|DEKTDE7G|ANYWHERE, ANYWHERE RD|AW - ANYWHERE - ANYCOUNTRY.

There is a two part process the first regex Filters out anything not recognised as an IBAN

REGEX_Match(replace([Concat_PAYM_NOTE],' ',''), '\|*/*([a-zA-Z]{2})\d{2}\w{4}\d{0,7}(\w?){0,16}/*.*?\|*.*')

and then it goes into the next one which separately identifies the 2 digit country code at the beginning and the IBAN code as a whole. CODE = REGEX_replace(replace([Concat_PAYM_NOTE],' ' ,''), '\|*/*([a-zA-Z]{2})\d{2}\w{4}\d{0,7}(\w?){0,16}/*.*?\|*.*','$1')

For info, CONCAT_PAYM_NOTEr is the name of the field

Any pointers, gratefully received. Thanks for your time.

13 REPLIES 13
fmvizcaino
17 - Castor
17 - Castor

Hi @DoneF ,

 

Attached is my example showing how to do it.

 

Best,

Fernando Vizcaino

DoneF
6 - Meteoroid

Thanks so much Fernando. This worked for the previous case but this string

ANY:2,AREA:ANYWHERE, COUNTRY|IRVTUS3NXXX|KW42BBYN0000000000000111111111|MR AMYONE|STREET:ANY ST.

returns US3NXXX but needs to return this KW42BBYN0000000000000111111111

I have no clue as to what to change on your example to get the required results.

 

Sorry to be such a nuisance.

Kind regards

Fran

afv2688
16 - Nebula
16 - Nebula

Hello @DoneF ,

 

Changed the logic a little bit, but should work now

 

Untitled.png

 

Edit: It works for your latest example too.

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Regards

DoneF
6 - Meteoroid

That's magic. Just need to bring it into my workflow.

Thank so much for your help

Enjoy the rest of your day.

Best regards

Fran

Labels