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
Solution Sage
Solution Sage

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
Solution Sage
Solution Sage

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
secondImage

New Return to Workplace

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

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Users online (4,416)