Skip to main content
Solved

Clearing all special characters expect defined special characters

  • January 30, 2025
  • 2 replies
  • 64 views

In the above image I want to clear all special characters expect .(dot) As their can be any thing in place of  ! number may have *, &, %, $, etc. I tried it using trashnondigit() function but it will remove all the characters from the number, Is their a way to do it?

Best answer by Adrian Anderson

Hi ​@Anurag choube .

The substituteAll() function might be helpful here. It takes a regular expression as the substitution pattern and can be used in lots of these cases.

For example, this will remove all non-digits, except for dots and hyphens (allowing for negative numbers as input):

substituteAll( '([^0-9\\.\\-])', '', value )

Let us know if this helps.

Kind regards,
Adrian

2 replies

Forum|alt.badge.img+1

Hi ​@Anurag choube .

The substituteAll() function might be helpful here. It takes a regular expression as the substitution pattern and can be used in lots of these cases.

For example, this will remove all non-digits, except for dots and hyphens (allowing for negative numbers as input):

substituteAll( '([^0-9\\.\\-])', '', value )

Let us know if this helps.

Kind regards,
Adrian


  • Author
  • Data Voyager
  • February 7, 2025

Thank you so much ​@Adrian Anderson  it worked.