Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Return the position of the last alphanumeric character in a string

ARHWAN0
6 - Meteoroid

Hi,

 

Trying to come up with a formula that will return the position of the last alphanumeric character in a string.  Some examples:

 

ABCD,(*&&%&        would return 4
12346?>_                   would return 5
XXXXXXX                  would return 7
)&*()&%                       would return -1 (no alphanumeric exists)

 

Any help would be greatly appreciated!

2 REPLIES 2
binuacs
21 - Polaris

@ARHWAN0 one way of doing this

image.png

IIF(Length(REGEX_Replace([Data], '[^A-z0-9]', '')) <=0,-1,Length(REGEX_Replace([Data], '[^A-z0-9]', '')))
ARHWAN0
6 - Meteoroid

@binuacs  Perfect, that was exactly what I was looking for; thanks!

Labels
Top Solution Authors