Let’s talk Alteryx Copilot. Join the live AMA event to connect with the Alteryx team, ask questions, and hear how others are exploring what Copilot can do. Have Copilot questions? Ask here!
Start Free Trial

Alteryx Designer Desktop Discussions

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

Extract Alpha Numeric String

bmillrine
8 - Asteroid

I am trying to extract out a sting from text body that is a string of 2 letters followed by 8 numbers. Not sure how to go about doing this i.e. I want to find strings like AB12345678. Not sure if this is Regex or string function.

 

Thanks

4 REPLIES 4
MarqueeCrew
20 - Arcturus
20 - Arcturus

@bmillrine,

 

regex_replace([String],".*?([a-zA-Z]{2}\d{8}).*",'$1')

That will get you the first occurrence of what you're looking for.  So something like mark Ab12345678 adam Ar12345678 will return: Ab12345678.

 

You can use that formula in a formula tool :)

 

If multiple values can exist, I would use the RegEx tool and configure it with the expression:

([a-zA-Z]{2}\d{8})

Then set the output method to Tokenize.

 

You can either output to Rows or Columns and get all values.

 

Cheers,

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
bmillrine
8 - Asteroid

That works great, thank you!

debn
6 - Meteoroid

I have a similar situation where i have a vstring alphnumeric field.  Need to parse the first 2 letters from the numeric portion.  There are no delimiters.  I tried trimright but it isn't working.  Most of the data set falls into the following format XX12345 or XX123456.  For any that don't fall into that format i would want to filter out.

 

Appreciate any suggestions you may offer.  thank you

debn
6 - Meteoroid

never fails - i post and then figure it out.

 

For anyone else looking to do this, this is the formula I used

trim([string],Right([string],5)) and trim([string],Right([string],6))

 

 

Labels
Top Solution Authors