Regex Replace
Hi all , I 'm trying to figure out how to perform the following javascript using formulas this.value = this.value.replace(/[^0-9+]/g, '') But I can 't figure out what the correct method is , there is Matches and Replace All , but none of these achieve what I want without getting overly complex . I imagine I must be missing something . Any suggestions ? ✅1I believe you can use Matches to get an array of matches and then Join them together . I 've set up a small example here : https://editor.nordcraft.com/projects/beige_adi_gallia_scary_wren/branches/start/components/HomePage?canvas-height=900&canvas-width=707.4&selection=formulas.03qwEL&rightpanel=style This is what I originally tried . It doesn 't work quite right as the user can still enter alpha characters , with it only changing once the user enters a numeric character again . Hence why you need to replace bad values , not just join the good ones together . My current solution is just to bind the JS snippet to the oninput attribute of the <input> field . If you want to limit the user to only write numbers in an input , you could set the input 's type attribute to number , or use the pattern attribute to limit which characters are allowed https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#pattern Thanks , These also aren 't quite right however . This is for a phone number , so its not truly numeric , meaning number Isn 't a good fit . Pattern also only provides validation on submission , not true limiting as you can type numbers . My current solution seems to be the best fit for now , at least until formulas get a regex-replace method .