Alteryx Designer Desktop Discussions

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

RegEx not working as wanted

SylviaK
8 - Asteroid

Hi

 

I am trying to get the following RegEx output

 

I have tried the RegEX tool using following expression: \u{3}_(\w+)_(\d{8})\.*\s\w+_\w{2}:\s(\d{5})\.*. Unfortunately, unsuccessful. Can someone pls help? 

 

Many thanks, 

 

 

3 REPLIES 3
fmvizcaino
17 - Castor
17 - Castor

Hi @SylviaK ,

 

You can use the following regex expression.

\u{3}_([^_]+).*?(\d{8}).*?(\d{5})

 

The ? is a lazy character that means it will form the smallest string until it finds \d{8} or \d{5}. The second case guarantees it will get the first 5 numbers from your string.

 

Best,

Fernando V.

SylviaK
8 - Asteroid

Beautiful! It works. can you please explain this expression: ([^_]+)

Many thanks. 

 

 

fmvizcaino
17 - Castor
17 - Castor

Sure!

[] is a group of possibilities

^ means not

+ 1 or multiple times

 

[^_]+ means everything but a _. It will get everything until it finds a _

 

If you have [123], it means the character can be 1, 2 or 3, but if you have [^123], it means everything but 1, 2 or 3.

 

 

Labels