Skip to main content

I am trying to extract the number before a decimal point but keep it as an integer. I have found posts about how to extract numbers, but they all convert them to text. I can’t seem to come up with the needed Regex formula, but I guess there might be another solution?

I would like to convert something like 2023.0 to just 2023.

Are you trying to do this in a workflow or on a form?


On a workflow in NAC.


Try adding and configuring a “Apply a regular expression” action in your workflow with the following settings:

  • Input text = Your number data (form field, variable, etc.)
  • Operation = Extract
  • Pattern = (\d)(?=\.)
  • Ignore case = Yes
  • Store first result in = intDigit  (workflow variable of type Integer)

 


Thanks. It does strip out the “.0” but also only leaves the last number before the decimal point. So 2023.0 just becomes “3”.


I just realized that when I upgraded this workflow from O365 to NAC it converted that variable to a decimal. I just created a new integer variable and replaced the old variable. I’m a little slow sometimes :(

 

It is working now.


Sorry, I misread your original post.

Glad it is working now for you.


Reply