Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Regex expression to extract characters between underscores

Travis_Ratliff
8 - Asteroid

I am trying to find a regex expression that will extract certain characters between two underscores. The problem I am currently having is that the regex outputs too many characters

InputOutput WantedOutput Wanted 2
wave(ELBA_DS_SBGF_GH_DA_JNG_JGH) - wave(ELBA_DS_CDAS_GH_DA_FNG_JHIY)SBGFCDAS
wave(ELBA_DS_MEBADGASW3_H_DA_JGK_KGHL) - wave(ELBA_DS_MRTYRTDV7FTW_H_DA_KGHJ_ITRY)MEBADGASW3MRTYRTDV7FTW
wave(ELBA_DS_AMBSPORT8ADK_GHJ_DA_PIK_ASG) - wave(ELBA_DS_EKHLGNSMILE5_GHJ_DA_ABC_MSG)AMBSPORT8ADKEKHLGNSMILE5

 

Currently to try and get the first Output I am using "\w{4}\w{2}\_(\w+)\_" which is giving me "SBGF_GH_DA_JNG" but I thought that the last \_ after the match group would make it stop and not include anything after that underscore.

 

Any help would be appreciated. Thanks

1 REPLY 1
ChrisTX
16 - Nebula
16 - Nebula

Try this expression in a RegEx tool in Tokenize mode:     (?:.*?)wave\(ELBA_DS_(.*?)_

 

Screenshot 2024-09-12 114429.png

 

Chris

Labels