In case you missed the announcement: The Alteryx One Fall Release is here! Learn more about the new features and capabilities here
ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests after December 31, 2025. Set up your security questions now so you can recover your account anytime, just log out and back in to get started. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

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

RegEx Parse formula for variable length times

JoshMcG
5 - Atom

Hello All,

 

I am using a RegEX tool to parse times using the following formula: (\d{2}:\d{2}:\d{2}.\d{3}) in this format: 00:00:14.522

 

The problem I have is when the runtime is under 10 seconds the time appears like this: 00:00:8.304 ith only a single digit for seconds (this doesn't happen for single minute or hour values).

 

Is there any way to put a range for the number of digits at the highlighted part of the formula?

 

(\d{2}:\d{2}:\d{2}.\d{3})

 

Appreciate any help.

 

Josh

3 REPLIES 3
neilgallen
12 - Quasar

@JoshMcG  You can specify a range as {2,#} where # is the upper end of your range, and flip this for a lower end.

 

Alternatively I believe you could write it as \d+:\d+:\d+.\d+ and it should capture any digits between the symbols.

j_acon
9 - Comet

Not an Regex Expert. There might be a better way to do it. But the below 2 work for me

 

(\d{2}:\d{2}:\d{1}.\d{3}) | (\d{2}:\d{2}:\d{2}.\d{3}) 

 

or

 

(\d{2}:\d{2}:(\d{1}|\d{2}).\d{3})

JoshMcG
5 - Atom

@neilgallen

 

This solution worked:  \d+:\d+:\d+.\d+

 

This one did not:  {2,#}

 

Thanks very much for your time and help, appreciate it,

 

Josh

Labels
Top Solution Authors