Alteryx Designer Desktop Discussions

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

Regex

praneshsapmm
8 - Asteroid

Hi ,

 

I have this requirement to extract a sub string from the given string meeting below requirements . 

 

1. No leading zeros 

2. No leading and trailing alphabets (uppercase & lower case)

3. Begin with number and end with number

 

For example :

 

String : AAA00012A300B0BB

Result : 12A300B0

 

String : 000AAA12A300B0BB

Result : 12A300B0

 

Thanks .

3 REPLIES 3
Jonathan-Sherman
15 - Aurora
15 - Aurora

Hi @praneshsapmm,

 

I would go with a Regex_Replace() function:

 

REGEX_Replace([String],"^([A-Z]|[0-9])\1{2,}([A-Z]|[0-9])\2{2,}(.*?)[A-Z]*$","$3")

 

JonathanSherman_0-1640862327711.png

 

 

I've attached my workflow for you to download if needed!

 

Kind regards,

Jonathan

Qiu
21 - Polaris
21 - Polaris

@praneshsapmm 
A slight different one

1230-praneshsapmm.PNG

praneshsapmm
8 - Asteroid

Hi @Jonathan-Sherman 

 

Thankyou . This works . 

 

Just another help .

 

Can you share regex function only to delete the trailing alphabets (uppercase and lowercase) in a string .

 

Thanks.

Labels
Top Solution Authors