ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests Early 2026. Make sure to check your account preferences in my.alteryx.com to make sure you have filled out your security questions. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
解決済み

RegEx Parse formula for variable length times

JoshMcG
アトム

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件の返信3
neilgallen
クエーサー

@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
コメット

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
アトム

@neilgallen

 

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

 

This one did not:  {2,#}

 

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

 

Josh

ラベル
トップのソリューション投稿者