Remove All Numbers

YGY
Participant IV

Hoping someone can help me. I’ trying to remove all numbers and “-” from a text field:

So from this:
5-A,4-C,3-R

To This:
A,C,R

Thanks.

Solved Solved
0 7 1,037
1 ACCEPTED SOLUTION

Assuming your text string pattern remains identical as you confirmed , with AppSheet expressions, you could try

SUBSTITUTE(EXTRACTMENTIONS(SUBSTITUTE(“5-A,4-C,3-R”,"-","@")),"@","")

Will give following result ( with space before and after commas)

A , C , R

Alternatively, a still longish expression
SUBSTITUTE(SUBSTITUTE(EXTRACTMENTIONS(SUBSTITUTE(“2-A,3-B,5-R”,"-","@")),"@","")," , “,”,")

Will give following result ( without space before and after commas as your given example shows)

A,C,R

Edit: Minor edits in description.

View solution in original post

7 REPLIES 7

Could you please update if
5-A,4-C,3-R is one text string or a combination of 3 different texts?

Also is the pattern one digit Number-Alphabet a consistent one or can it change

5-A,4-C,3-R is one text string and the pattern will always be the same.

Thanks @Suvrutt_Gurjar

There’s really no good way to do this with AppSheet: it’s possible but it’s super ugly and very delicate. If you’re using Google Sheets and can tolerate a sync to get the result, add another column to the spreadsheet with a formula of:

=REGEXREPLACE(A2, "\d+-", "")

replacing A2 with the spreadsheet column containing the original value. Copy the formula down for all existing rows of the spreadsheet, then regenerate the table’s columns in the app to pick up the new spreadsheet column. The new app column’s configuration should include a Spreadsheet formula setting that looks similar to (but slightly different than) the formula above. This new column will receive the modified original value after a new original value is entered and the app syncs.

Unless REGEXREPLACE() isn’t supported… Hmm…

Thanks for your idea @Steve Steve, I’ll give it a try as I think syncing might actually be a good thing in this case.

Assuming your text string pattern remains identical as you confirmed , with AppSheet expressions, you could try

SUBSTITUTE(EXTRACTMENTIONS(SUBSTITUTE(“5-A,4-C,3-R”,"-","@")),"@","")

Will give following result ( with space before and after commas)

A , C , R

Alternatively, a still longish expression
SUBSTITUTE(SUBSTITUTE(EXTRACTMENTIONS(SUBSTITUTE(“2-A,3-B,5-R”,"-","@")),"@","")," , “,”,")

Will give following result ( without space before and after commas as your given example shows)

A,C,R

Edit: Minor edits in description.

Excellent, thank you @Suvrutt_Gurjar that worked.

Nicely done!

Top Labels in this Space