cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Kudo Kingpin
Kudo Kingpin

Strip all punctuation from a text input

I'm trying to allow my users to paste whole paragraphs of text into a text box, which I then need to parse without any punctuation. I'm happy with the parsing, but not sure of the best way to remove punctuation.

 

Looking at the Substitute function, and thinking back to my InfoPath days, it doesn't let you replace characters by position. So for example I can't list all the characters I want to remove and 'replace' them with a blank string.

 

I guess I could nest a bunch of substitutes as below, but this feels inefficient.

 

Substitute(Substitute(Substitute(TextInput1.Text, ".", ""), ",", ""), ";", ""), etc.....

 

Any thoughts?

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Super User
Super User

Re: Strip all punctuation from a text input

Highlighted
Kudo Kingpin
Kudo Kingpin

Re: Strip all punctuation from a text input

Instant solution!

 

In case anyone finds this, save yourself a hop with the following:-

 

Concat(Filter(Split(TextInput1.Text,""),IsMatch(Result, "^[a-zA-Z0-9]*$")),Result)

View solution in original post

5 REPLIES 5
Highlighted
Super User
Super User

Re: Strip all punctuation from a text input

Highlighted
Kudo Kingpin
Kudo Kingpin

Re: Strip all punctuation from a text input

Instant solution!

 

In case anyone finds this, save yourself a hop with the following:-

 

Concat(Filter(Split(TextInput1.Text,""),IsMatch(Result, "^[a-zA-Z0-9]*$")),Result)

View solution in original post

Highlighted
Advocate I
Advocate I

Re: Strip all punctuation from a text input

@davidstone VERY HAPPY you shared it here, because hopping over to that other page led to: Access Denied - You do not have sufficient privileges for this resource or its parent to perform this action.

 

Not sure why that page is dead/inaccessible

Highlighted
Regular Visitor

Re: Strip all punctuation from a text input

Hi David,

 

I'm quite new to the PowerApp universe (building my first app for a customer). I want to apply this to a field where truck drivers are supposed to enter their registration number in a text field (called "DataCardValue16.txt). Where exactly would I use the following Concat function?

 

Concat(Filter(Split(DataCardValue16.Text,""),IsMatch(Result, "^[A-Z0-9]*$")),Result)

 

Do I paste it in the update field of the DataCard itself?

Highlighted
Advocate I
Advocate I

Re: Strip all punctuation from a text input

I would put it on the OnChange hook of the input field itself, so after they change the field and defocus it, it will fire your function and remove special characters

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,011)