removing leading zeroes from text variable

I have a input variable that contains leading zeroes. I need to removed the leading zeroes to use as a filter into a table. I can use 

s = s.replace(/^0+/, '')

to remove the leading zeroes via java script. But I cannot find out how to use this as part of a filter on a table. Any suggestions?

Thanks

Kevin

You can use the regex_replace action and assign to a variable and use it in the filter.

Regards,

Leandro.

Or Just the Replace() function.

Leandro Correa wrote:

You can use the regex_replace action and assign to a variable and use it in the filter.

Regards,

Leandro.

Leandro

I tried using Regex_Replace with the text string with leading zeroes, the Pattern "/^0+/ and replace string "". This does not seem to work. It is not replacing my leading zeroes. You mention using the replace. How would that work with replacing the leading zeroes? I did seen any examples using the replace with regex.

Kevin


Solution

Hello Kevin, 


The result is in the Regex_Replace.result variable. 

  • In the first var1 I assign 00001500
  • In the second var1 I asign the result of the Regex_Replace to var1. You need this last step to update the original variable 





Solution

If you to convert the text var to integer using the TextToInteger() function will works too! ;)

Leandro Correa wrote:

I had everything that Erik has provided but was using the "/" in the Pattern. Once I removed the "/", it worked. Thanks everyone for providing suggestions. 

 

If you to convert the text var to integer using the TextToInteger() function will works too! ;)



Marked Erik's response as the solution. Again, thanks to everyone.

Glad to hear you solved it!