Alteryx Designer Desktop Discussions

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

Removing Leading and Trailing Alphabets in a string

praneshsapmm
8 - Asteroid

Hi,

 

Is there any way to remove Leading and trailing alphabets (A-Z & a-z) within the string of any length . 

 

Thanks.

5 REPLIES 5
Jonathan-Sherman
15 - Aurora
15 - Aurora

Hi @praneshsapmm,

 

You could use a regex replace function:

REGEX_Replace([Data], '^[a-z]*(.*?)[a-z]*$', '$1')

 

Kind regards,

Jonathan

Jonathan-Sherman
15 - Aurora
15 - Aurora

Also attached an example of how it would work!

 

Kind regards,

Jonathan

brandon_bunney
8 - Asteroid

Not sure what you mean exactly by "leading and trailing alphabets", but perhaps this post on stackoverflow would contain the regex pattern you are seeking?

 

https://stackoverflow.com/questions/61544656/avoid-leading-and-trailing-spaces-on-alphanumeric-strin...

praneshsapmm
8 - Asteroid

Hi @Jonathan-Sherman 

 

This works . THankyou very much . 

 

Also can you let me know the regex function to remove : 

 

1. Leading Alphabets 

2. Trailing Alphabets.

 

Thanks

 

Jonathan-Sherman
15 - Aurora
15 - Aurora

Hi @praneshsapmm,

 

The function above would remove leading and trailing alphabets, did you want a formula to do each on separately or did you mean something else?

 

Kind regards,

Jonathan

Labels