@replace specific characters

I’m trying to use @replacesubstring to trim all non-numeric values in a field.

I tried to use this code, but it didn’t work.

@replacesubstring(@text(@thisvalue);“+{A-z}”;“”)

The only success I have had was in typing out all the letters. I then put in an input validation to make sure they did not enter any alphanumeric symbols because the input validation seems to run before the input translation.

This is the code that worked:

@replacesubstring(@text(@thisvalue);“A”:“B”:“C”:“D”: etc…

Is there any way to shorten this? I will need to be able to trim all non-alpha characters after I do this, but I figured the code woudl be almost identical.

Thank you in advance for any assistance.

Subject: @replace specific characters

The easiest and most comprehensive method would be to switch to JavaScript and use a regular expression to replace all non-numeric characters with an empty string:

document.forms[0].FieldName.value = document.forms[0].FieldName.value.replace(/\D/g,“”);

Subject: @replace specific characters

You could try this in the Input Validation: @If(!@Matches(@Text(@ThisValue);“+{^0-9}”);@Return(“NO GOOD”);@Success)