Trim / Compress text help with a script

  • I need to compress text added in a textinput box then show this text without symbols, space etc.

User has a Textinput50 - User can type inn text here
User has a Textinput52 (Disabled = True) - User can copy text from here if needed.

Textinput50: ** 1 - 3%51/2.0,9_A +?!'4 2 * d "_.#12 **
Textinput52: 1351209A42d12

I will use the textinput52 as a unique key to validate if user is traying to register the same values

My table has
ID: incremental
Code: char255
CodeCompr: Uniqe

Is there away to trim out all the Space, Tab, Symbols so user is only left with The numbers from 0-9 and letters A-Z?

As I'm new to ReTool and have no experience with JavaScript I need to know if this is possible.

I'd suggest using .replace() with RegEx:

{{ textInput50.value.replace(/[^a-zA-Z0-9]/g, '') }}

.replace() returns a new string, it will not modify the original, which is perfect for here

1 Like

Thank you very much that. This worked and is perfect for my use.

1 Like