Cast your vote for the official 2025 Inspire Pin! Designs were submitted by fellow Community members and reflect the creativity and passion of Alteryx users across the globe. Vote now!
Free Trial

Alteryx Designer Desktop Discussions

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

How to extract a certain part of a string field?

Anudeep_Yalamuru
8 - Asteroid

Hi All,

 

I have a field which has a lot of text. But I want to extract a certain part "rollnumber-AXXXXB". Please find the sample file attached. and a screenshot for reference as well.

 

Please provide your valuable inputs. 

 

Thanks,

Anudeep

7 REPLIES 7
alexnajm
18 - Pollux
18 - Pollux

What Regex have you tried so far? Seems like you could do .+(rollnumber-\w+)".+

ChrisTX
16 - Nebula
16 - Nebula

Try the RegEx tool with this expression:    

 

.*-(rollnumber.*)".*

 

 

Screenshot 2024-09-11 064857.png

 

Chris

Anudeep_Yalamuru
8 - Asteroid

@alexnajm This is what I tried. 

 

.(rollnumber.)"*

 

Anudeep_Yalamuru
8 - Asteroid

@ChrisTX Thanks, that worked. Appreciate your help :)

alexnajm
18 - Pollux
18 - Pollux

@Anudeep_Yalamuru By putting a single period, The statement above is expecting only one single character before the word rollnumber and one single character after. That’s why @ChrisTX and I added quantifiers like + and * to make sure the expression took into account more than one character. 

both of our statements should get you a similar product, although it looks like Chris has tested his and I just typed mine out :)

Anudeep_Yalamuru
8 - Asteroid

Thanks Alex. Your solution is working as well. Just checked it there. Understand your feedback on what I did wrong as well. I should brush up my regex skills :)

alexnajm
18 - Pollux
18 - Pollux

No problem! :)

Labels
Top Solution Authors